git.delta.rocks / unique-network / refs/commits / 5259d552fbda

difftreelog

Missing tests added

str-mv2021-08-13parent: #d8afbf6.patch.diff
in: master

1 file changed

modifiedtests/src/mintModes.test.tsdiffbeforeafterboth
before · tests/src/mintModes.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { IKeyringPair } from '@polkadot/types/types';7import privateKey from './substrate/privateKey';8import usingApi from './substrate/substrate-api';9import {10  addToWhiteListExpectSuccess,11  createCollectionExpectSuccess,12  createItemExpectFailure,13  createItemExpectSuccess,14  enableWhiteListExpectSuccess,15  setMintPermissionExpectSuccess,16  addCollectionAdminExpectSuccess,17  disableWhiteListExpectSuccess,18} from './util/helpers';1920describe('Integration Test public minting', () => {21  let alice: IKeyringPair;22  let bob: IKeyringPair;2324  before(async () => {25    await usingApi(async () => {26      alice = privateKey('//Alice');27      bob = privateKey('//Bob');28    });29  });3031  it('If the public minting mode is enabled and the whitelist mode is enabled, then the address added to the whitelist and not the owner or administrator can create tokens', async () => {32    await usingApi(async () => {33      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });34      await enableWhiteListExpectSuccess(alice, collectionId);35      await setMintPermissionExpectSuccess(alice, collectionId, true);36      await addToWhiteListExpectSuccess(alice, collectionId, bob.address);3738      await createItemExpectSuccess(bob, collectionId, 'NFT');39    });40  });4142  it('Public minting mode is disabled then the address that is user cannot create tokens', async () => {43    await usingApi(async () => {44      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });45      await disableWhiteListExpectSuccess(alice, collectionId);46      await setMintPermissionExpectSuccess(alice, collectionId, false);47      await addToWhiteListExpectSuccess(alice, collectionId, bob.address);48      await createItemExpectFailure(bob, collectionId, 'NFT');49    });50  });5152  it('Public minting mode is disabled then the address that is admin can create tokens', async () => {53    await usingApi(async () => {54      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });55      await disableWhiteListExpectSuccess(alice, collectionId);56      await setMintPermissionExpectSuccess(alice, collectionId, false);57      await addToWhiteListExpectSuccess(alice, collectionId, bob.address);58      await addCollectionAdminExpectSuccess(alice, collectionId, bob);59      await createItemExpectSuccess(bob, collectionId, 'NFT');60    });61  });6263  it('Public minting mode is disabled then the address that is collection owner can create tokens', async () => {64    await usingApi(async () => {65      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });66      await disableWhiteListExpectSuccess(alice, collectionId);67      await setMintPermissionExpectSuccess(alice, collectionId, false);68      await addToWhiteListExpectSuccess(alice, collectionId, bob.address);69      await createItemExpectSuccess(alice, collectionId, 'NFT');70    });71  });727374  it('Public minting mode is enabled and address not included in whitelist that is user cannot create tokens', async () => {75    await usingApi(async () => {76      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });77      await enableWhiteListExpectSuccess(alice, collectionId);78      await setMintPermissionExpectSuccess(alice, collectionId, true);79      await createItemExpectFailure(bob, collectionId, 'NFT');80    });81  });8283  it('Public minting mode is enabled and address not included in whitelist that is admin can create tokens', async () => {84    await usingApi(async () => {85      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });86      await enableWhiteListExpectSuccess(alice, collectionId);87      await setMintPermissionExpectSuccess(alice, collectionId, true);88      await addCollectionAdminExpectSuccess(alice, collectionId, bob);89      await createItemExpectSuccess(bob, collectionId, 'NFT');90    });91  });9293  it('Public minting mode is enabled and address not included in whitelist that is owner can create tokens', async () => {94    await usingApi(async () => {95      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });96      await enableWhiteListExpectSuccess(alice, collectionId);97      await setMintPermissionExpectSuccess(alice, collectionId, true);98      await createItemExpectSuccess(alice, collectionId, 'NFT');99    });100  });101102});103104describe('Integration Test private minting', () => {105  let alice: IKeyringPair;106  let bob: IKeyringPair;107108  before(async () => {109    await usingApi(async () => {110      alice = privateKey('//Alice');111      bob = privateKey('//Bob');112    });113  });114115  it('If the private minting mode is enabled then the address that is the owner or admin cannot create tokens', async () => {116    await usingApi(async () => {117      const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });118      await enableWhiteListExpectSuccess(alice, collectionId);119      await setMintPermissionExpectSuccess(alice, collectionId, false);120      await addToWhiteListExpectSuccess(alice, collectionId, bob.address);121122      await createItemExpectFailure(bob, collectionId, 'NFT');123    });124  });125126});