import { getModuleAccountAddress } from "./module-account"; describe("getModuleAccountAddress", () => { test("returns the address only for the requested module", () => { const response = { account: { base_account: { address: "thor1module", }, name: "thorchain", }, }; expect(getModuleAccountAddress(response, "thorchain")).toBe("thor1module"); expect(getModuleAccountAddress(response, "other")).toBeUndefined(); }); test("returns undefined for an incomplete response", () => { expect(getModuleAccountAddress(undefined, "thorchain")).toBeUndefined(); expect( getModuleAccountAddress({ account: { name: "thorchain" } }, "thorchain") ).toBeUndefined(); }); });