-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
620 additions
and
47 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/__snapshots__/createRollupPrepareDeploymentParamsConfig.unit.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { getCustomParentChains, registerCustomParentChain } from './chains'; | ||
import { testHelper_createCustomParentChain } from './testHelpers'; | ||
|
||
describe('registerCustomParentChain', () => { | ||
it(`throws if "contracts.rollupCreator.address" is invalid`, () => { | ||
// omit contracts from the chain | ||
const { contracts, ...chain } = testHelper_createCustomParentChain(); | ||
|
||
expect(() => | ||
registerCustomParentChain({ | ||
...chain, | ||
contracts: { | ||
rollupCreator: { | ||
address: '0x123', | ||
}, | ||
tokenBridgeCreator: { | ||
address: '0x123', | ||
}, | ||
}, | ||
}), | ||
).toThrowError( | ||
`"contracts.rollupCreator.address" is invalid for custom parent chain with id ${chain.id}`, | ||
); | ||
}); | ||
|
||
it(`throws if "contracts.tokenBridgeCreator.address" is invalid`, () => { | ||
// omit contracts from the chain | ||
const { contracts, ...chain } = testHelper_createCustomParentChain(); | ||
|
||
expect(() => | ||
registerCustomParentChain({ | ||
...chain, | ||
contracts: { | ||
rollupCreator: { | ||
// use a correct address for the RollupCreator | ||
address: contracts.rollupCreator.address, | ||
}, | ||
tokenBridgeCreator: { | ||
address: '0x0', | ||
}, | ||
}, | ||
}), | ||
).toThrowError( | ||
`"contracts.tokenBridgeCreator.address" is invalid for custom parent chain with id ${chain.id}`, | ||
); | ||
}); | ||
|
||
it('successfully registers a custom parent chain', () => { | ||
const chain = testHelper_createCustomParentChain(); | ||
|
||
// assert before | ||
expect(getCustomParentChains().map((c) => c.id)).not.includes(chain.id); | ||
|
||
// register | ||
registerCustomParentChain(chain); | ||
|
||
// assert after | ||
expect(getCustomParentChains().map((c) => c.id)).includes(chain.id); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.