git.delta.rocks / unique-network / refs/commits / 214ea65f5fbb

difftreelog

fix tests

Trubnikov Sergey2022-12-15parent: #bc29f10.patch.diff
in: master

1 file changed

modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
17import {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';
2323
33 });33 });
3434
35 [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});
4746
48 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 }]);