@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
23 lines (20 loc) • 862 B
text/typescript
import { validateAddress } from "./validateAddress";
// Since isInvalidRecipient is called internally, we need to mock the entire validateAddress function
// or test the actual behavior. For Jest 30 compatibility, we'll test the actual behavior
// and verify isInvalidRecipient is called by checking the implementation behavior.
describe("validateAddress", () => {
it.each([
["invalid", true],
["valid_address_long_enough", false],
["ab", true], // length <= 3
["abc", true], // length <= 3
["abcd", false], // length > 3 and no "invalid"
])(
"should call isInvalidRecipient and return expected value for address '%s'",
async (address: string, expectedValue: boolean) => {
const parameters = {};
const result = await validateAddress(address, parameters);
expect(result).toEqual(expectedValue);
},
);
});