From 214ea65f5fbba7db181f53e955afc0b66c87e402 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Thu, 15 Dec 2022 08:57:11 +0000 Subject: [PATCH] fix: tests --- --- a/tests/src/eth/tokenProperties.test.ts +++ b/tests/src/eth/tokenProperties.test.ts @@ -17,7 +17,7 @@ import {IKeyringPair} from '@polkadot/types/types'; import {Contract} from 'web3-eth-contract'; import {itEth, usingEthPlaygrounds, expect} from './util'; -import {ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types'; +import {ITokenPropertyPermission} from '../util/playgrounds/types'; import {Pallets} from '../util'; import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique'; @@ -33,31 +33,29 @@ }); [ - {mode: 'nft'}, - {mode: 'rft'} + {mode: 'nft' as const, requiredPallets: []}, + {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]}, ].map(testCase => - itEth(`[${testCase.mode}] Set and get token property permissions`, async({helper}) => { - const owner = await helper.eth.createAccountWithBalance(donor); - const caller = await helper.ethCrossAccount.createAccountWithBalance(donor); - const mode: any = testCase.mode; - for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) { - const {collectionId, collectionAddress} = await helper.eth.createCollection(mode, owner, 'A', 'B', 'C'); - const collection = await helper.ethNativeContract.collection(collectionAddress, mode, owner); - await collection.methods.addCollectionAdminCross(caller).send({from: owner}); + itEth.ifWithPallets.only(`[${testCase.mode}] Set and get token property permissions`, testCase.requiredPallets, async({helper}) => { + const owner = await helper.eth.createAccountWithBalance(donor); + const caller = await helper.ethCrossAccount.createAccountWithBalance(donor); + for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) { + const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C'); + const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner); + await collection.methods.addCollectionAdminCross(caller).send({from: owner}); - await collection.methods.setTokenPropertyPermissions([['testKey', [[0, mutable], [1, tokenOwner], [2, collectionAdmin]]]]).send({from: caller.eth}); + await collection.methods.setTokenPropertyPermissions([['testKey', [[0, mutable], [1, tokenOwner], [2, collectionAdmin]]]]).send({from: caller.eth}); - expect(await helper.nft.getPropertyPermissions(collectionId)).to.be.deep.equal([{ - key: 'testKey', - permission: {mutable, collectionAdmin, tokenOwner}, - }]); + expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{ + key: 'testKey', + permission: {mutable, collectionAdmin, tokenOwner}, + }]); - expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([ - ['testKey', [['0', mutable], ['1', tokenOwner], ['2', collectionAdmin]]] - ]); - } - }) - ); + expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([ + ['testKey', [['0', mutable], ['1', tokenOwner], ['2', collectionAdmin]]], + ]); + } + })); [ { -- gitstuff