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

difftreelog

source

tests/src/rmrk/deleteCollection.seqtest.ts1.3 KiBsourcehistory
1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure, requirePallets, Pallets} from './util/helpers';3import {createCollection, deleteCollection} from './util/tx';45describe('integration test: delete collection', () => {6  let api: any;7  before(async function () {8    api = await getApiConnection();9    await requirePallets(this, [Pallets.RmrkCore]);10  });1112  const alice = '//Alice';13  const bob = '//Bob';1415  it('delete NFT collection', async () => {16    await createCollection(17      api,18      alice,19      'test-metadata',20      null,21      'test-symbol',22    ).then(async (collectionId) => {23      await deleteCollection(api, alice, collectionId.toString());24    });25  });2627  it('[negative] delete non-existing NFT collection', async () => {28    const tx = deleteCollection(api, alice, '99999');29    await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);30  });3132  it('[negative] delete not an owner NFT collection', async () => {33    await createCollection(34      api,35      alice,36      'test-metadata',37      null,38      'test-symbol',39    ).then(async (collectionId) => {40      const tx = deleteCollection(api, bob, collectionId.toString());41      await expectTxFailure(/rmrkCore.NoPermission/, tx);42    });43  });4445  after(async() => { await api.disconnect(); });46});