difftreelog
Missing tests added
in: master
1 file changed
tests/src/mintModes.test.tsdiffbeforeafterboth1//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});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.only('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 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('If the whitelist mode is enabled, address not included in whitelist that is user cannot create tokens', async () => {43 await usingApi(async () => {44 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });45 await enableWhiteListExpectSuccess(alice, collectionId);46 await setMintPermissionExpectSuccess(alice, collectionId, true);47 await createItemExpectFailure(bob, collectionId, 'NFT');48 });49 });5051 it('If the whitelist mode is enabled, address not included in whitelist that is admin can create tokens', async () => {52 await usingApi(async () => {53 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });54 await enableWhiteListExpectSuccess(alice, collectionId);55 await setMintPermissionExpectSuccess(alice, collectionId, true);56 await addCollectionAdminExpectSuccess(alice, collectionId, bob);57 await createItemExpectSuccess(bob, collectionId, 'NFT');58 });59 });6061 it('If the whitelist mode is enabled, address not included in whitelist that is owner can create tokens', async () => {62 await usingApi(async () => {63 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });64 await enableWhiteListExpectSuccess(alice, collectionId);65 await setMintPermissionExpectSuccess(alice, collectionId, true);66 await createItemExpectSuccess(alice, collectionId, 'NFT');67 });68 });6970 it('If the whitelist mode is disabled, owner can create tokens', async () => {71 await usingApi(async () => {72 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });73 await disableWhiteListExpectSuccess(alice, collectionId);74 await setMintPermissionExpectSuccess(alice, collectionId, true);75 await createItemExpectSuccess(alice, collectionId, 'NFT');76 });77 });7879 it('If the whitelist mode is disabled, collection admin can create tokens', async () => {80 await usingApi(async () => {81 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });82 await disableWhiteListExpectSuccess(alice, collectionId);83 await setMintPermissionExpectSuccess(alice, collectionId, true);84 await addCollectionAdminExpectSuccess(alice, collectionId, bob);85 await createItemExpectSuccess(bob, collectionId, 'NFT');86 });87 });8889 it('If the whitelist mode is disabled, regular user can`t create tokens', async () => {90 await usingApi(async () => {91 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });92 await disableWhiteListExpectSuccess(alice, collectionId);93 await setMintPermissionExpectSuccess(alice, collectionId, true);94 await createItemExpectFailure(bob, collectionId, 'NFT');95 });96 });97});9899describe.only('Integration Test private minting', () => {100 let alice: IKeyringPair;101 let bob: IKeyringPair;102103 before(async () => {104 await usingApi(async () => {105 alice = privateKey('//Alice');106 bob = privateKey('//Bob');107 });108 });109110 it('Address that is the not owner or not admin cannot create tokens', async () => {111 await usingApi(async () => {112 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });113 await enableWhiteListExpectSuccess(alice, collectionId);114 await setMintPermissionExpectSuccess(alice, collectionId, false);115 await addToWhiteListExpectSuccess(alice, collectionId, bob.address);116 await createItemExpectFailure(bob, collectionId, 'NFT');117 });118 });119120 it('Address that is collection owner can create tokens', async () => {121 await usingApi(async () => {122 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });123 await disableWhiteListExpectSuccess(alice, collectionId);124 await setMintPermissionExpectSuccess(alice, collectionId, false);125 //await addCollectionAdminExpectSuccess(alice, collectionId, bob);126 await createItemExpectSuccess(alice, collectionId, 'NFT');127 });128 });129130 it('Address that is user cannot create tokens', async () => {131 await usingApi(async () => {132 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });133 await disableWhiteListExpectSuccess(alice, collectionId);134 await setMintPermissionExpectSuccess(alice, collectionId, false);135 // await addToWhiteListExpectSuccess(alice, collectionId, bob.address);136 await createItemExpectFailure(bob, collectionId, 'NFT');137 });138 });139});