@uniswap/smart-wallet-sdk
Version:
⚒️ An SDK for building applications with smart wallets on Uniswap
22 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("../constants");
const delegation_1 = require("./delegation");
describe('Delegation', () => {
describe('parseFromCode', () => {
const address = `1111111111111111111111111111111111111111`; // address length without 0x prefix
it('parses out the delegation', () => {
const delegation = delegation_1.Delegation.parseFromCode(`${constants_1.DELEGATION_MAGIC_PREFIX}${address}`);
expect(delegation).toBe(`0x${address}`);
});
it('throws an error if there is no delegation', () => {
const emptyDelegation = '';
expect(() => delegation_1.Delegation.parseFromCode(emptyDelegation)).toThrow();
});
it('throws an error if the magic prefix is incorrect', () => {
const incorrectMagicPrefix = '0x000000';
expect(() => delegation_1.Delegation.parseFromCode(`${incorrectMagicPrefix}${address}`)).toThrow(`Invalid delegation magic prefix: ${incorrectMagicPrefix}`);
});
});
});
//# sourceMappingURL=delegation.test.js.map