git.delta.rocks / unique-network / refs/commits / f921c0198e51

difftreelog

tests: remove scheduler from required pallets + fix some lint warnings

Fahrrader2022-10-19parent: #3896cd1.patch.diff
in: master

4 files changed

modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
16
17import {Contract} from 'web3-eth-contract';
1816
19import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
20import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from './util';18import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from './util';
93 const donor = await privateKey({filename: __filename});91 const donor = await privateKey({filename: __filename});
94 const [alice] = await helper.arrange.createAccounts([10n], donor);92 const [alice] = await helper.arrange.createAccounts([10n], donor);
95 ({collectionId: simpleNftCollectionId} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}));93 ({collectionId: simpleNftCollectionId} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}));
96 minter = helper.eth.createAccount();94 minter = await helper.eth.createAccountWithBalance(donor);
97 ({collectionId: erc721MetadataCompatibleNftCollectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(minter, 'n', 'd', 'p', BASE_URI));95 ({collectionId: erc721MetadataCompatibleNftCollectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(minter, 'n', 'd', 'p', BASE_URI));
98 });96 });
99 });97 });
modifiedtests/src/eth/collectionProperties.test.tsdiffbeforeafterboth
18import {Pallets} from '../util';18import {Pallets} from '../util';
19import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';19import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';
20import {IKeyringPair} from '@polkadot/types/types';20import {IKeyringPair} from '@polkadot/types/types';
21import {Contract} from 'web3-eth-contract';
2221
23describe('EVM collection properties', () => {22describe('EVM collection properties', () => {
24 let donor: IKeyringPair;23 let donor: IKeyringPair;
99 const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);98 const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);
100 await contract.methods.addCollectionAdmin(bruh).send(); // to check that admin will work too99 await contract.methods.addCollectionAdmin(bruh).send(); // to check that admin will work too
101100
102 const collection1 = await helper.nft.getCollectionObject(collectionId);101 const collection1 = helper.nft.getCollectionObject(collectionId);
103 const data1 = await collection1.getData();102 const data1 = await collection1.getData();
104 expect(data1?.raw.flags.erc721metadata).to.be.false;103 expect(data1?.raw.flags.erc721metadata).to.be.false;
105 expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.false;104 expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.false;
109108
110 expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.true;109 expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.true;
111110
112 const collection2 = await helper.nft.getCollectionObject(collectionId);111 const collection2 = helper.nft.getCollectionObject(collectionId);
113 const data2 = await collection2.getData();112 const data2 = await collection2.getData();
114 expect(data2?.raw.flags.erc721metadata).to.be.true;113 expect(data2?.raw.flags.erc721metadata).to.be.true;
115114
116 const TPPs = data2?.raw.tokenPropertyPermissions;115 const propertyPermissions = data2?.raw.tokenPropertyPermissions;
117 expect(TPPs?.length).to.equal(2);116 expect(propertyPermissions?.length).to.equal(2);
118117
119 expect(TPPs.find((tpp: ITokenPropertyPermission) => {118 expect(propertyPermissions.find((tpp: ITokenPropertyPermission) => {
120 return tpp.key === 'URI' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;119 return tpp.key === 'URI' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;
121 })).to.be.not.null;120 })).to.be.not.null;
122121
123 expect(TPPs.find((tpp: ITokenPropertyPermission) => {122 expect(propertyPermissions.find((tpp: ITokenPropertyPermission) => {
124 return tpp.key === 'URISuffix' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;123 return tpp.key === 'URISuffix' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;
125 })).to.be.not.null;124 })).to.be.not.null;
126125
modifiedtests/src/eth/util/index.tsdiffbeforeafterboth
14import chai from 'chai';14import chai from 'chai';
15import chaiAsPromised from 'chai-as-promised';15import chaiAsPromised from 'chai-as-promised';
16import chaiLike from 'chai-like';16import chaiLike from 'chai-like';
17import {getTestSeed, requirePalletsOrSkip} from '../../util';17import {getTestSeed, MINIMUM_DONOR_FUND, requirePalletsOrSkip} from '../../util';
1818
19chai.use(chaiAsPromised);19chai.use(chaiAsPromised);
20chai.use(chaiLike);20chai.use(chaiLike);
43 else {43 else {
44 const actualSeed = getTestSeed(seed.filename);44 const actualSeed = getTestSeed(seed.filename);
45 let account = helper.util.fromSeed(actualSeed, ss58Format);45 let account = helper.util.fromSeed(actualSeed, ss58Format);
46 if (await helper.balance.getSubstrate(account.address) == 0n) {46 if (await helper.balance.getSubstrate(account.address) < MINIMUM_DONOR_FUND) {
47 console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);47 console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);
48 account = helper.util.fromSeed('//Alice', ss58Format);48 account = helper.util.fromSeed('//Alice', ss58Format);
49 }49 }
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
62 const chain = await helper.callRpc('api.rpc.system.chain', []);62 const chain = await helper.callRpc('api.rpc.system.chain', []);
6363
64 const refungible = 'refungible';64 const refungible = 'refungible';
65 const scheduler = 'scheduler';65 // const scheduler = 'scheduler';
66 const foreignAssets = 'foreignassets';66 const foreignAssets = 'foreignassets';
67 const rmrkPallets = ['rmrkcore', 'rmrkequip'];67 const rmrkPallets = ['rmrkcore', 'rmrkequip'];
68 const appPromotion = 'apppromotion';68 const appPromotion = 'apppromotion';
6969
70 if (chain.eq('OPAL by UNIQUE')) {70 if (chain.eq('OPAL by UNIQUE')) {
71 requiredPallets.push(71 requiredPallets.push(
72 refungible,72 refungible,
73 scheduler,73 // scheduler,
74 foreignAssets,74 foreignAssets,
75 appPromotion,75 appPromotion,
76 ...rmrkPallets,76 ...rmrkPallets,