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

difftreelog

source

tests/src/enableDisableTransfer.test.ts2.1 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  setTransferFlagExpectFailure,17} from './util/helpers';1819chai.use(chaiAsPromised);2021describe('Enable/Disable Transfers', () => {22  it('User can transfer token with enabled transfer flag', async () => {23    await usingApi(async () => {24      const Alice = privateKey('//Alice');25      const Bob = privateKey('//Bob');26      // nft27      const nftCollectionId = await createCollectionExpectSuccess();28      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');2930      // explicitely set transfer flag31      await setTransferFlagExpectSuccess(Alice, nftCollectionId, true);3233      await transferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1);34    });35  });3637  it('User can\'n transfer token with disabled transfer flag', async () => {38    await usingApi(async () => {39      const Alice = privateKey('//Alice');40      const Bob = privateKey('//Bob');41      // nft42      const nftCollectionId = await createCollectionExpectSuccess();43      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');4445      // explicitely set transfer flag46      await setTransferFlagExpectSuccess(Alice, nftCollectionId, false);4748      await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);49    });50  });51});5253describe('Negative Enable/Disable Transfers', () => {54  it('Non-owner cannot change transfer flag', async () => {55    await usingApi(async () => {56      const Bob = privateKey('//Bob');57      // nft58      const nftCollectionId = await createCollectionExpectSuccess();5960      // Change transfer flag61      await setTransferFlagExpectFailure(Bob, nftCollectionId, false);62    });63  });64});