git.delta.rocks / unique-network / refs/commits / 6c1065a66823

difftreelog

source

tests/src/enableDisableTransfer.test.ts1.7 KiBsourcehistory
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import privateKey from './substrate/privateKey';9import usingApi from './substrate/substrate-api';10import {11  createItemExpectSuccess,12  createCollectionExpectSuccess,13  transferExpectSuccess,14  transferExpectFailure,15  setTransferFlagExpectSuccess,16} from './util/helpers';1718chai.use(chaiAsPromised);1920describe('Enable/Disable Transfers', () => {21  it('User can transfer token with enabled transfer flag', async () => {22    await usingApi(async () => {23      const Alice = privateKey('//Alice');24      const Bob = privateKey('//Bob');25      // nft26      const nftCollectionId = await createCollectionExpectSuccess();27      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');2829      // explicitely set transfer flag30      await setTransferFlagExpectSuccess(Alice, nftCollectionId, true);3132      await transferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1);33    });34  });3536  it('User can\'n transfer token with disabled transfer flag', async () => {37    await usingApi(async () => {38      const Alice = privateKey('//Alice');39      const Bob = privateKey('//Bob');40      // nft41      const nftCollectionId = await createCollectionExpectSuccess();42      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');4344      // explicitely set transfer flag45      await setTransferFlagExpectSuccess(Alice, nftCollectionId, false);4647      await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);48    });49  });50});