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

difftreelog

source

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