git.delta.rocks / unique-network / refs/commits / d41cda7482d4

difftreelog

source

tests/src/rmrk/deleteCollection.test.ts1.2 KiBsourcehistory
1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure} from './util/helpers';3import {createCollection, deleteCollection} from './util/tx';45describe('integration test: delete collection', () => {6  let api: any;7  before(async () => {8    api = await getApiConnection();9  });1011  const Alice = '//Alice';12  const Bob = '//Bob';1314  it('delete NFT collection', async () => {15    await createCollection(16      api,17      Alice,18      'test-metadata',19      null,20      'test-symbol',21    ).then(async (collectionId) => {22      await deleteCollection(api, Alice, collectionId.toString());23    });24  });2526  it('[negative] delete non-existing NFT collection', async () => {27    const tx = deleteCollection(api, Alice, '99999');28    await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);29  });3031  it('[negative] delete not an owner NFT collection', async () => {32    await createCollection(33      api,34      Alice,35      'test-metadata',36      null,37      'test-symbol',38    ).then(async (collectionId) => {39      const tx = deleteCollection(api, Bob, collectionId.toString());40      await expectTxFailure(/rmrkCore.NoPermission/, tx);41    });42  });4344  after(() => {45    api.disconnect();46  });47});