From 5259d552fbdab868c69b7d7e6f9328a0d3904dc3 Mon Sep 17 00:00:00 2001 From: str-mv Date: Fri, 13 Aug 2021 16:51:07 +0000 Subject: [PATCH] Missing tests added --- --- a/tests/src/mintModes.test.ts +++ b/tests/src/mintModes.test.ts @@ -17,7 +17,7 @@ disableWhiteListExpectSuccess, } from './util/helpers'; -describe('Integration Test public minting', () => { +describe.only('Integration Test public minting', () => { let alice: IKeyringPair; let bob: IKeyringPair; @@ -28,7 +28,7 @@ }); }); - 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 () => { + it('If the whitelist mode is enabled, then the address added to the whitelist and not the owner or administrator can create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); await enableWhiteListExpectSuccess(alice, collectionId); @@ -39,69 +39,64 @@ }); }); - it('Public minting mode is disabled then the address that is user cannot create tokens', async () => { + it('If the whitelist mode is enabled, address not included in whitelist that is user cannot create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await disableWhiteListExpectSuccess(alice, collectionId); - await setMintPermissionExpectSuccess(alice, collectionId, false); - await addToWhiteListExpectSuccess(alice, collectionId, bob.address); + await enableWhiteListExpectSuccess(alice, collectionId); + await setMintPermissionExpectSuccess(alice, collectionId, true); await createItemExpectFailure(bob, collectionId, 'NFT'); }); }); - it('Public minting mode is disabled then the address that is admin can create tokens', async () => { + it('If the whitelist mode is enabled, address not included in whitelist that is admin can create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await disableWhiteListExpectSuccess(alice, collectionId); - await setMintPermissionExpectSuccess(alice, collectionId, false); - await addToWhiteListExpectSuccess(alice, collectionId, bob.address); + await enableWhiteListExpectSuccess(alice, collectionId); + await setMintPermissionExpectSuccess(alice, collectionId, true); await addCollectionAdminExpectSuccess(alice, collectionId, bob); await createItemExpectSuccess(bob, collectionId, 'NFT'); }); }); - it('Public minting mode is disabled then the address that is collection owner can create tokens', async () => { + it('If the whitelist mode is enabled, address not included in whitelist that is owner can create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await disableWhiteListExpectSuccess(alice, collectionId); - await setMintPermissionExpectSuccess(alice, collectionId, false); - await addToWhiteListExpectSuccess(alice, collectionId, bob.address); + await enableWhiteListExpectSuccess(alice, collectionId); + await setMintPermissionExpectSuccess(alice, collectionId, true); await createItemExpectSuccess(alice, collectionId, 'NFT'); }); }); - - it('Public minting mode is enabled and address not included in whitelist that is user cannot create tokens', async () => { + it('If the whitelist mode is disabled, owner can create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await enableWhiteListExpectSuccess(alice, collectionId); + await disableWhiteListExpectSuccess(alice, collectionId); await setMintPermissionExpectSuccess(alice, collectionId, true); - await createItemExpectFailure(bob, collectionId, 'NFT'); + await createItemExpectSuccess(alice, collectionId, 'NFT'); }); }); - it('Public minting mode is enabled and address not included in whitelist that is admin can create tokens', async () => { + it('If the whitelist mode is disabled, collection admin can create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await enableWhiteListExpectSuccess(alice, collectionId); + await disableWhiteListExpectSuccess(alice, collectionId); await setMintPermissionExpectSuccess(alice, collectionId, true); await addCollectionAdminExpectSuccess(alice, collectionId, bob); await createItemExpectSuccess(bob, collectionId, 'NFT'); }); }); - it('Public minting mode is enabled and address not included in whitelist that is owner can create tokens', async () => { + it('If the whitelist mode is disabled, regular user can`t create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); - await enableWhiteListExpectSuccess(alice, collectionId); + await disableWhiteListExpectSuccess(alice, collectionId); await setMintPermissionExpectSuccess(alice, collectionId, true); - await createItemExpectSuccess(alice, collectionId, 'NFT'); + await createItemExpectFailure(bob, collectionId, 'NFT'); }); }); - }); -describe('Integration Test private minting', () => { +describe.only('Integration Test private minting', () => { let alice: IKeyringPair; let bob: IKeyringPair; @@ -112,15 +107,33 @@ }); }); - it('If the private minting mode is enabled then the address that is the owner or admin cannot create tokens', async () => { + it('Address that is the not owner or not admin cannot create tokens', async () => { await usingApi(async () => { const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); await enableWhiteListExpectSuccess(alice, collectionId); await setMintPermissionExpectSuccess(alice, collectionId, false); await addToWhiteListExpectSuccess(alice, collectionId, bob.address); - await createItemExpectFailure(bob, collectionId, 'NFT'); }); }); + it('Address that is collection owner can create tokens', async () => { + await usingApi(async () => { + const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); + await disableWhiteListExpectSuccess(alice, collectionId); + await setMintPermissionExpectSuccess(alice, collectionId, false); + //await addCollectionAdminExpectSuccess(alice, collectionId, bob); + await createItemExpectSuccess(alice, collectionId, 'NFT'); + }); + }); + + it('Address that is user cannot create tokens', async () => { + await usingApi(async () => { + const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } }); + await disableWhiteListExpectSuccess(alice, collectionId); + await setMintPermissionExpectSuccess(alice, collectionId, false); + // await addToWhiteListExpectSuccess(alice, collectionId, bob.address); + await createItemExpectFailure(bob, collectionId, 'NFT'); + }); + }); }); -- gitstuff