git.delta.rocks / unique-network / refs/commits / 65f16a33ae17

difftreelog

source

tests/src/rmrk/deleteCollection.test.ts1.3 KiBsourcehistory
1import {getApiConnection} from '../substrate/substrate-api';2import {requirePallets, Pallets} from '../util/helpers';3import {expectTxFailure} from './util/helpers';4import {createCollection, deleteCollection} from './util/tx';56describe('integration test: delete collection', () => {7  let api: any;8  before(async function () {9    api = await getApiConnection();10    await requirePallets(this, [Pallets.RmrkCore]);11  });1213  const Alice = '//Alice';14  const Bob = '//Bob';1516  it('delete NFT collection', async () => {17    await createCollection(18      api,19      Alice,20      'test-metadata',21      null,22      'test-symbol',23    ).then(async (collectionId) => {24      await deleteCollection(api, Alice, collectionId.toString());25    });26  });2728  it('[negative] delete non-existing NFT collection', async () => {29    const tx = deleteCollection(api, Alice, '99999');30    await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);31  });3233  it('[negative] delete not an owner NFT collection', async () => {34    await createCollection(35      api,36      Alice,37      'test-metadata',38      null,39      'test-symbol',40    ).then(async (collectionId) => {41      const tx = deleteCollection(api, Bob, collectionId.toString());42      await expectTxFailure(/rmrkCore.NoPermission/, tx);43    });44  });4546  after(() => {47    api.disconnect();48  });49});