1234567891011121314151617import type {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds, expect, itSub} from './util/index.js';1920describe('Integration Test: ownerCanTransfer allows admins to use only transferFrom/burnFrom:', () => {21 let alice: IKeyringPair;22 let bob: IKeyringPair;23 let charlie: IKeyringPair;2425 before(async () => {26 await usingPlaygrounds(async (helper, privateKey) => {27 const donor = await privateKey({url: import.meta.url});28 [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);29 });30 });3132 itSub('admin transfers other user\'s token', async ({helper}) => {33 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});34 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});35 const limits = await helper.collection.getEffectiveLimits(collectionId);36 expect(limits.ownerCanTransfer).to.be.true;3738 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});39 await expect(helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address})).to.be.rejected;4041 await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});42 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);43 expect(newTokenOwner).to.be.deep.equal({Substrate: charlie.address});44 });4546 itSub('admin burns other user\'s token', async ({helper}) => {47 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL'});4849 await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: true});50 const limits = await helper.collection.getEffectiveLimits(collectionId);51 expect(limits.ownerCanTransfer).to.be.true;5253 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});5455 await expect(helper.nft.burnToken(alice, collectionId, tokenId)).to.be.rejected;5657 await helper.nft.burnToken(bob, collectionId, tokenId);58 const token = await helper.nft.getToken(collectionId, tokenId);59 expect(token).to.be.null;60 });61});