difftreelog
fix tests
in: master
1 file changed
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth17import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';18import {Contract} from 'web3-eth-contract';18import {Contract} from 'web3-eth-contract';19import {itEth, usingEthPlaygrounds, expect} from './util';19import {itEth, usingEthPlaygrounds, expect} from './util';20import {ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types';20import {ITokenPropertyPermission} from '../util/playgrounds/types';21import {Pallets} from '../util';21import {Pallets} from '../util';22import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique';22import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique';232333 });33 });343435 [35 [36 {mode: 'nft'},36 {mode: 'nft' as const, requiredPallets: []},37 {mode: 'rft'}37 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]},38 ].map(testCase =>38 ].map(testCase =>39 itEth(`[${testCase.mode}] Set and get token property permissions`, async({helper}) => {39 itEth.ifWithPallets.only(`[${testCase.mode}] Set and get token property permissions`, testCase.requiredPallets, async({helper}) => {40 const owner = await helper.eth.createAccountWithBalance(donor);40 const owner = await helper.eth.createAccountWithBalance(donor);41 const caller = await helper.ethCrossAccount.createAccountWithBalance(donor);41 const caller = await helper.ethCrossAccount.createAccountWithBalance(donor);42 const mode: any = testCase.mode;43 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {42 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {44 const {collectionId, collectionAddress} = await helper.eth.createCollection(mode, owner, 'A', 'B', 'C');43 const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C');45 const collection = await helper.ethNativeContract.collection(collectionAddress, mode, owner);44 const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner);46 await collection.methods.addCollectionAdminCross(caller).send({from: owner});45 await collection.methods.addCollectionAdminCross(caller).send({from: owner});474648 await collection.methods.setTokenPropertyPermissions([['testKey', [[0, mutable], [1, tokenOwner], [2, collectionAdmin]]]]).send({from: caller.eth});47 await collection.methods.setTokenPropertyPermissions([['testKey', [[0, mutable], [1, tokenOwner], [2, collectionAdmin]]]]).send({from: caller.eth});49 48 50 expect(await helper.nft.getPropertyPermissions(collectionId)).to.be.deep.equal([{49 expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{51 key: 'testKey',50 key: 'testKey',52 permission: {mutable, collectionAdmin, tokenOwner},51 permission: {mutable, collectionAdmin, tokenOwner},53 }]);52 }]);