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

difftreelog

tests: add failing tests for bulk mint overfow

Yaroslav Bolyukin2021-03-05parent: #2b06b09.patch.diff
in: master

1 file changed

modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
11import {11import {
12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,
13 destroyCollectionExpectSuccess,13 destroyCollectionExpectSuccess,
14 getGenericResult,
14 IReFungibleTokenDataType,15 IReFungibleTokenDataType,
16 setCollectionLimitsExpectSuccess,
15} from './util/helpers';17} from './util/helpers';
1618
17chai.use(chaiAsPromised);19chai.use(chaiAsPromised);
93 });95 });
94 });96 });
97
98 it('Can mint amount of items equals to collection limits', async () => {
99 await usingApi(async (api) => {
100 const alice = privateKey('//Alice');
101
102 const collectionId = await createCollectionExpectSuccess();
103 await setCollectionLimitsExpectSuccess(alice, collectionId, {
104 TokenLimit: 2,
105 });
106 const args = [
107 { nft: ['A', 'A'] },
108 { nft: ['B', 'B'] },
109 ];
110 const createMultipleItemsTx = api.tx.nft.createMultipleItems(collectionId, alice.address, args);
111 const events = await submitTransactionAsync(alice, createMultipleItemsTx);
112 const result = getGenericResult(events);
113 expect(result.success).to.be.true;
114 });
115 });
95});116});
96117
97describe('Negative Integration Test createMultipleItems(collection_id, owner, items_data):', () => {118describe('Negative Integration Test createMultipleItems(collection_id, owner, items_data):', () => {
176 });197 });
177 });198 });
199
200 it('Fails when minting tokens exceeds collectionLimits amount', async () => {
201 await usingApi(async (api) => {
202 const alice = privateKey('//Alice');
203
204 const collectionId = await createCollectionExpectSuccess();
205 await setCollectionLimitsExpectSuccess(alice, collectionId, {
206 TokenLimit: 1,
207 });
208 const args = [
209 { nft: ['A', 'A'] },
210 { nft: ['B', 'B'] },
211 ];
212 const createMultipleItemsTx = api.tx.nft.createMultipleItems(collectionId, alice.address, args);
213 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
214 });
215 });
178});216});
179217