1import { IKeyringPair } from '@polkadot/types/types';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import privateKey from '../substrate/privateKey';5import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import {7 createCollectionExpectSuccess,8 normalizeAccountId,9 waitNewBlocks,10} from '../util/helpers';1112chai.use(chaiAsPromised);13const expect = chai.expect;14let Alice: IKeyringPair;15let Bob: IKeyringPair;16let Ferdie: IKeyringPair;1718before(async () => {19 await usingApi(async () => {20 Alice = privateKey('//Alice');21 Bob = privateKey('//Bob');22 Ferdie = privateKey('//Ferdie');23 });24});2526describe('Deleting a collection while add address to whitelist: ', () => {27 28 it('Adding an address to the collection whitelist in a block by the admin, and deleting the collection by the owner ', async () => {29 await usingApi(async (api) => {30 const collectionId = await createCollectionExpectSuccess();31 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));32 await submitTransactionAsync(Alice, changeAdminTx);33 await waitNewBlocks(1);34 35 const addWhitelistAdm = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Ferdie.address));36 const destroyCollection = api.tx.nft.destroyCollection(collectionId);37 await Promise.all([38 addWhitelistAdm.signAndSend(Bob),39 destroyCollection.signAndSend(Alice),40 ]);41 await waitNewBlocks(1);42 let whiteList = false;43 whiteList = (await api.query.nft.whiteList(collectionId, Ferdie.address)).toJSON() as boolean;44 45 expect(whiteList).to.be.false;46 await waitNewBlocks(2);47 });48 });49});