git.delta.rocks / unique-network / refs/commits / 5dde94553863

difftreelog

test nesting under non-existing token

Yaroslav Bolyukin2023-01-18parent: #6ad82a2.patch.diff
in: master

1 file changed

modifiedtests/src/sub/nesting/common.test.tsdiffbeforeafterboth
122 await expect(collectionForNesting.transfer(alice, targetToken.nestingAccount(), 50n)).to.be.rejectedWith('common.UserIsNotAllowedToNest');122 await expect(collectionForNesting.transfer(alice, targetToken.nestingAccount(), 50n)).to.be.rejectedWith('common.UserIsNotAllowedToNest');
123 });123 });
124
125 itSub('Cannot nest to a future collection', async ({helper}) => {
126 const nonExistingCollectionId = await helper.collection.getTotalCount() + 1000;
127 const futureToken = helper.nft.getTokenObject(nonExistingCollectionId, 1);
128
129 const nftCollectionForNesting = await helper.nft.mintCollection(alice);
130 const rftCollectionForNesting = await helper.rft.mintCollection(alice);
131 const ftCollectionForNesting = await helper.ft.mintCollection(alice);
132
133 // 1. Alice cannot create nested token to future token
134 await expect(nftCollectionForNesting.mintToken(alice, futureToken.nestingAccount())).to.be.rejectedWith('CollectionNotFound');
135 await expect(rftCollectionForNesting.mintToken(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('CollectionNotFound');
136 await expect(ftCollectionForNesting.mint(alice, 10n, futureToken.nestingAccount())).to.be.rejectedWith('CollectionNotFound');
137
138 // 2. Alice cannot mint and nest token:
139 const nft = await nftCollectionForNesting.mintToken(alice);
140 const rft = await rftCollectionForNesting.mintToken(alice, 100n);
141 const _ft = await ftCollectionForNesting.mint(alice, 100n);
142 await expect(nft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('CollectionNotFound');
143 await expect(rft.transfer(alice, futureToken.nestingAccount())).to.be.rejectedWith('CollectionNotFound');
144 await expect(ftCollectionForNesting.transfer(alice, futureToken.nestingAccount(), 50n)).to.be.rejectedWith('CollectionNotFound');
145 });
124146
125 itSub('Cannot nest to a future token', async ({helper}) => {147 itSub('Cannot nest to a future token in a NFT collection', async ({helper}) => {
126 const nonExistingCollectionId = await helper.collection.getTotalCount() + 1000;148 const {collectionId} = await helper.nft.mintCollection(alice);
149 // To avoid UserIsNotAllowedToNest error
150 await helper.collection.setPermissions(alice, collectionId, {nesting: {collectionAdmin: true}});
127 const futureToken = helper.nft.getTokenObject(nonExistingCollectionId, 1);151 const futureToken = helper.nft.getTokenObject(collectionId, 1);
128152
129 const nftCollectionForNesting = await helper.nft.mintCollection(alice);153 const nftCollectionForNesting = await helper.nft.mintCollection(alice);
130 const rftCollectionForNesting = await helper.rft.mintCollection(alice);154 const rftCollectionForNesting = await helper.rft.mintCollection(alice);