1234567891011121314151617import {IKeyringPair} from '@polkadot/types/types';18import chai from 'chai';19import chaiAsPromised from 'chai-as-promised';20import {default as usingApi} from './substrate/substrate-api';21import {22 createCollectionExpectSuccess,23 createItemExpectSuccess,24 transferExpectFailure,25 transferFromExpectSuccess,26 burnItemExpectFailure,27 burnFromExpectSuccess,28 setCollectionLimitsExpectSuccess,29} from './util/helpers';3031chai.use(chaiAsPromised);32const expect = chai.expect;3334describe('Integration Test: ownerCanTransfer allows admins to use only transferFrom/burnFrom:', () => {35 let alice: IKeyringPair;36 let bob: IKeyringPair;37 let charlie: IKeyringPair;3839 before(async () => {40 await usingApi(async (api, privateKeyWrapper) => {41 alice = privateKeyWrapper('//Alice');42 bob = privateKeyWrapper('//Bob');43 charlie = privateKeyWrapper('//Charlie');44 });45 });4647 it('admin transfers other user\'s token', async () => {48 await usingApi(async () => {49 const collectionId = await createCollectionExpectSuccess();50 await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});5152 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', {Substrate: bob.address});5354 await transferExpectFailure(collectionId, tokenId, alice, charlie);5556 await transferFromExpectSuccess(collectionId, tokenId, alice, bob, charlie, 1);57 });58 });5960 it('admin burns other user\'s token', async () => {61 await usingApi(async () => {62 const collectionId = await createCollectionExpectSuccess();63 await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});6465 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', {Substrate: bob.address});6667 await burnItemExpectFailure(alice, collectionId, tokenId);6869 await burnFromExpectSuccess(alice, bob, collectionId, tokenId);70 });71 });72});