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} from '../util/helpers';910chai.use(chaiAsPromised);11const expect = chai.expect;12let Alice: IKeyringPair;13let Bob: IKeyringPair;14let Ferdie: IKeyringPair;1516before(async () => {17 await usingApi(async () => {18 Alice = privateKey('//Alice');19 Bob = privateKey('//Bob');20 Ferdie = privateKey('//Ferdie');21 });22});2324describe('Deleting a collection while add address to whitelist: ', () => {25 26 it('Adding an address to the collection whitelist in a block by the admin, and deleting the collection by the owner ', async () => {27 await usingApi(async (api) => {28 const collectionId = await createCollectionExpectSuccess();29 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);30 await submitTransactionAsync(Alice, changeAdminTx);31 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));32 await timeoutPromise(10000);33 34 const addWhitelistAdm = api.tx.nft.addToWhiteList(collectionId, Ferdie.address);35 const destroyCollection = api.tx.nft.destroyCollection(collectionId);36 await Promise.all([37 addWhitelistAdm.signAndSend(Bob),38 destroyCollection.signAndSend(Alice),39 ]);40 await timeoutPromise(10000);41 let whiteList = false;42 whiteList = (await api.query.nft.whiteList(collectionId, Ferdie.address)).toJSON() as boolean;43 44 expect(whiteList).to.be.false;45 await timeoutPromise(20000);46 });47 });48});