@hyperlane-xyz/sdk
Version:
The official SDK for the Hyperlane Network
49 lines • 1.82 kB
JavaScript
import { expect } from 'chai';
import { TestChainName } from '../../consts/testChains.js';
import { randomAddress } from '../../test/testUtils.js';
import { shouldAddVerificationInput } from './utils.js';
describe('shouldAddVerificationInput', () => {
const addressA = randomAddress();
const addressB = randomAddress();
it('should return true if the artifact does not exist in the verification inputs', () => {
const verificationInputs = {
[TestChainName.test1]: [
{
name: 'ContractA',
address: addressA,
constructorArguments: 'args',
isProxy: false,
},
],
};
const newArtifact = {
name: 'ContractB',
address: addressB,
constructorArguments: 'argsB',
isProxy: true,
};
const chain = TestChainName.test1;
expect(shouldAddVerificationInput(verificationInputs, chain, newArtifact)).to.equal(true);
});
it('should return false if the artifact already exists in the verification inputs', () => {
const verificationInputs = {
[TestChainName.test2]: [
{
name: 'ContractA',
address: addressA,
constructorArguments: 'args',
isProxy: false,
},
],
};
const existingArtifact = {
name: 'ContractA',
address: addressA,
constructorArguments: 'args',
isProxy: false,
};
const chain = TestChainName.test2;
expect(shouldAddVerificationInput(verificationInputs, chain, existingArtifact)).to.equal(false);
});
});
//# sourceMappingURL=utils.test.js.map