123456import 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 27 const nftCollectionId = await createCollectionExpectSuccess();28 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');2930 31 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 42 const nftCollectionId = await createCollectionExpectSuccess();43 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');4445 46 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 58 const nftCollectionId = await createCollectionExpectSuccess();5960 61 await setTransferFlagExpectFailure(Bob, nftCollectionId, false);62 });63 });64});