git.delta.rocks / unique-network / refs/commits / d3f529b73942

difftreelog

Fix tests

Max Andreev2023-01-18parent: #81ec604.patch.diff
in: master

1 file changed

modifiedtests/src/sub/nesting/common.test.tsdiffbeforeafterboth
131 const ftCollectionForNesting = await helper.ft.mintCollection(alice);131 const ftCollectionForNesting = await helper.ft.mintCollection(alice);
132132
133 // 1. Alice cannot create nested token to future token133 // 1. Alice cannot create nested token to future token
134 await expect(nftCollectionForNesting.mintToken(alice, futureToken.nestingAccount())).to.be.rejectedWith('TODO:add message');134 await expect(nftCollectionForNesting.mintToken(alice, futureToken.nestingAccount())).to.be.rejectedWith('TokenNotFound');
135 await expect(rftCollectionForNesting.mintToken(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('TODO:add message');135 await expect(rftCollectionForNesting.mintToken(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('TokenNotFound');
136 await expect(ftCollectionForNesting.mint(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('TODO:add message');136 await expect(ftCollectionForNesting.mint(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('TokenNotFound');
137137
138 // 2. Alice cannot mint and nest token:138 // 2. Alice cannot mint and nest token:
139 const nft = await nftCollectionForNesting.mintToken(alice);139 const nft = await nftCollectionForNesting.mintToken(alice);
140 const rft = await rftCollectionForNesting.mintToken(alice, 100n);140 const rft = await rftCollectionForNesting.mintToken(alice, 100n);
141 const _ft = await ftCollectionForNesting.mint(alice, 100n);141 const _ft = await ftCollectionForNesting.mint(alice, 100n);
142 await expect(nft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('TODO:add message');142 await expect(nft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('TokenNotFound');
143 await expect(rft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('TODO:add message');143 await expect(rft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('TokenNotFound');
144 await expect(ftCollectionForNesting.transfer(alice, futureToken.nestingAccount(), 50n)).to.be.rejectedWith('TODO:add message');144 await expect(ftCollectionForNesting.transfer(alice, futureToken.nestingAccount(), 50n)).to.be.rejectedWith('TokenNotFound');
145 });145 });
146146
147 itEth('Cannot nest to collection address', async({helper}) => {147 itEth('Cannot nest to collection address', async({helper}) => {
152 const nftCollectionForNesting = await helper.nft.mintCollection(alice);152 const nftCollectionForNesting = await helper.nft.mintCollection(alice);
153153
154 // 1. Alice cannot create nested token to collection address154 // 1. Alice cannot create nested token to collection address
155 await expect(nftCollectionForNesting.mintToken(alice, {Ethereum: existingCollectionAddress})).to.be.rejectedWith('TODO:add message');155 await expect(nftCollectionForNesting.mintToken(alice, {Ethereum: existingCollectionAddress})).to.be.rejectedWith('CantNestTokenUnderCollection');
156 await expect(nftCollectionForNesting.mintToken(alice, {Ethereum: futureCollectionAddress})).to.be.rejectedWith('TODO:add message');156 await expect(nftCollectionForNesting.mintToken(alice, {Ethereum: futureCollectionAddress})).to.be.rejectedWith('CantNestTokenUnderCollection');
157157
158 // 2. Alice cannot mint and nest token to collection address:158 // 2. Alice cannot mint and nest token to collection address:
159 const nft = await nftCollectionForNesting.mintToken(alice);159 const nft = await nftCollectionForNesting.mintToken(alice);
160 await expect(nft.transfer(alice, {Ethereum: existingCollectionAddress})).to.be.rejectedWith('TODO:add message');160 await expect(nft.transfer(alice, {Ethereum: existingCollectionAddress})).to.be.rejectedWith('CantNestTokenUnderCollection');
161 await expect(nft.transfer(alice, {Ethereum: futureCollectionAddress})).to.be.rejectedWith('TODO:add message');161 await expect(nft.transfer(alice, {Ethereum: futureCollectionAddress})).to.be.rejectedWith('CantNestTokenUnderCollection');
162 });162 });
163163
164 itSub.ifWithPallets('Cannot nest in RFT', [Pallets.ReFungible], async ({helper}) => {164 itEth.ifWithPallets('Cannot nest in RFT or FT', [Pallets.ReFungible], async ({helper}) => {
165 // Create default collection, permissions are not set:165 // Create default collection, permissions are not set:
166 const rftCollection = await helper.rft.mintCollection(alice);166 const rftCollection = await helper.rft.mintCollection(alice);
167 const ftCollection = await helper.ft.mintCollection(alice);
168
167 const targetToken = await rftCollection.mintToken(alice);169 const rftToken = await rftCollection.mintToken(alice);
170 const _ftToken = await ftCollection.mint(alice, 100n);
168171
169 const collectionForNesting = await helper.nft.mintCollection(alice);172 const collectionForNesting = await helper.nft.mintCollection(alice);
170173
171 // 1. Alice cannot create immediately nested tokens:174 // 1. Alice cannot create immediately nested tokens:
172 await expect(collectionForNesting.mintToken(alice, targetToken.nestingAccount())).to.be.rejectedWith('refungible.RefungibleDisallowsNesting');175 await expect(collectionForNesting.mintToken(alice, rftToken.nestingAccount())).to.be.rejectedWith('refungible.RefungibleDisallowsNesting');
176 await expect(collectionForNesting.mintToken(alice, {Ethereum: helper.ethAddress.fromTokenId(ftCollection.collectionId, 0)})).to.be.rejectedWith('fungible.FungibleDisallowsNesting');
173177
174 // 2. Alice cannot mint and nest token:178 // 2. Alice cannot mint and nest token:
175 const nestedToken2 = await collectionForNesting.mintToken(alice);179 const nestedToken2 = await collectionForNesting.mintToken(alice);
176 await expect(nestedToken2.nest(alice, targetToken)).to.be.rejectedWith('refungible.RefungibleDisallowsNesting');180 await expect(nestedToken2.nest(alice, rftToken)).to.be.rejectedWith('refungible.RefungibleDisallowsNesting');
181 await expect(ftCollection.transfer(alice, {Ethereum: helper.ethAddress.fromTokenId(ftCollection.collectionId, 0)})).to.be.rejectedWith('fungible.FungibleDisallowsNesting');
177 });182 });
178});183});
179184