difftreelog
Tests: eth tokenProperties small improvements
in: master
1 file changed
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth1import {IKeyringPair} from '@polkadot/types/types';1import {cartesian} from './util/helpers';2import {usingPlaygrounds} from './../util/playgrounds/index';2import {itEth, expect} from '../eth/util/playgrounds';3import {itEth, expect} from '../eth/util/playgrounds';344describe('EVM token properties', () => {5describe('EVM token properties', () => {6 let donor: IKeyringPair;7 let alice: IKeyringPair;89 before(async () => {10 await usingPlaygrounds(async (helper, privateKey) => {11 donor = privateKey('//Alice');12 [alice] = await helper.arrange.createAccounts([1000n], donor);13 });14 });155 itEth('Can be reconfigured', async({helper, privateKey}) => {16 itEth('Can be reconfigured', async({helper}) => {6 const alice = privateKey('//Alice');7 const caller = await helper.eth.createAccountWithBalance(alice);17 const caller = await helper.eth.createAccountWithBalance(donor);8189 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {19 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {10 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'ethp'});20 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'ethp'});23 }33 }24 });34 });253526 itEth('Can be set', async({helper, privateKey}) => {36 itEth('Can be set', async({helper}) => {27 const alice = privateKey('//Alice');28 const caller = await helper.eth.createAccountWithBalance(alice);37 const caller = await helper.eth.createAccountWithBalance(donor);29 const collection = await helper.nft.mintCollection(alice, {38 const collection = await helper.nft.mintCollection(alice, {30 tokenPrefix: 'ethp',39 tokenPrefix: 'ethp',31 tokenPropertyPermissions: [{40 tokenPropertyPermissions: [{48 expect(value).to.equal('testValue');57 expect(value).to.equal('testValue');49 });58 });505951 itEth('Can be deleted', async({helper, privateKey}) => {60 itEth('Can be deleted', async({helper}) => {52 const alice = privateKey('//Alice');53 const caller = await helper.eth.createAccountWithBalance(alice);61 const caller = await helper.eth.createAccountWithBalance(donor);54 const collection = await helper.nft.mintCollection(alice, {62 const collection = await helper.nft.mintCollection(alice, {55 tokenPrefix: 'ethp',63 tokenPrefix: 'ethp',56 tokenPropertyPermissions: [{64 tokenPropertyPermissions: [{76 expect(result.length).to.equal(0);84 expect(result.length).to.equal(0);77 });85 });788679 itEth('Can be read', async({helper, privateKey}) => {87 itEth('Can be read', async({helper}) => {80 const alice = privateKey('//Alice');81 const caller = await helper.eth.createAccountWithBalance(alice);88 const caller = await helper.eth.createAccountWithBalance(donor);82 const collection = await helper.nft.mintCollection(alice, {89 const collection = await helper.nft.mintCollection(alice, {83 tokenPrefix: 'ethp',90 tokenPrefix: 'ethp',84 tokenPropertyPermissions: [{91 tokenPropertyPermissions: [{100});107});101108109110type ElementOf<A> = A extends readonly (infer T)[] ? T : never;111function* cartesian<T extends Array<Array<any>>, R extends Array<any>>(internalRest: [...R], ...args: [...T]): Generator<[...R, ...{[K in keyof T]: ElementOf<T[K]>}]> {112 if(args.length === 0) {113 yield internalRest as any;114 return;115 }116 for(const value of args[0]) {117 yield* cartesian([...internalRest, value], ...args.slice(1)) as any;118 }119}