git.delta.rocks / unique-network / refs/commits / 2e0d1a668d33

difftreelog

source

tests/src/rmrk/setCollectionProperty.seqtest.ts1.6 KiBsourcehistory
1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure, requirePallets, Pallets} from './util/helpers';3import {createCollection, setPropertyCollection} from './util/tx';45describe('integration test: set collection property', () => {6  const alice = '//Alice';7  const bob = '//Bob';89  let api: any;10  before(async function () {11    api = await getApiConnection();12    await requirePallets(this, [Pallets.RmrkCore]);13  });1415  it('set collection property', async () => {16    await createCollection(17      api,18      alice,19      'test-metadata',20      null,21      'test-symbol',22    ).then(async (collectionId) => {23      await setPropertyCollection(api, alice, collectionId, 'test_key', '42');24      await setPropertyCollection(api, alice, collectionId, 'test_key', '10');25      await setPropertyCollection(26        api,27        alice,28        collectionId,29        'second_test_key',30        '111',31      );32    });33  });3435  it('[negative] set non-existing collection property', async () => {36    const tx = setPropertyCollection(37      api,38      alice,39      9999,40      'test_key',41      '42',42    );43    await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);44  });4546  it('[negative] set property not an owner NFT collection issuer', async () => {47    await createCollection(48      api,49      bob,50      'test-metadata',51      null,52      'test-symbol',53    ).then(async (collectionId) => {54      const tx = setPropertyCollection(55        api,56        alice,57        collectionId,58        'test_key',59        '42',60      );61      await expectTxFailure(/rmrkCore\.NoPermission/, tx);62    });63  });6465  after(async() => { await api.disconnect(); });66});