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

difftreelog

Merge pull request #258 from UniqueNetwork/fix/unit_tests

kozyrevdev2021-12-03parents: #12f45ba #7bc9172.patch.diff
in: master
Unit tests fixed

6 files changed

modifiedpallets/unique/src/mock.rsdiffbeforeafterboth
193}193}
194194
195impl pallet_template::Config for Test {195impl pallet_template::Config for Test {
196 type Event = ();
196 type WeightInfo = ();197 type WeightInfo = ();
197}198}
198199
modifiedpallets/unique/src/tests.rsdiffbeforeafterboth
2259 new_test_ext().execute_with(|| {2259 new_test_ext().execute_with(|| {
2260 let origin1 = Origin::signed(1);2260 let origin1 = Origin::signed(1);
22612261
2262 for i in 1..COLLECTION_NUMBER_LIMIT {2262 for i in 1..=COLLECTION_NUMBER_LIMIT {
2263 create_test_collection(&CollectionMode::NFT, CollectionId(i));2263 create_test_collection(&CollectionMode::NFT, CollectionId(i));
2264 }2264 }
22652265
modifiedtests/src/eth/payable.test.tsdiffbeforeafterboth
3import {submitTransactionAsync} from '../substrate/substrate-api';3import {submitTransactionAsync} from '../substrate/substrate-api';
4import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';4import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';
5import {evmToAddress} from '@polkadot/util-crypto';5import {evmToAddress} from '@polkadot/util-crypto';
6import {getGenericResult} from '../util/helpers';6import {getGenericResult, UNIQUE} from '../util/helpers';
7import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';7import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';
88
9describe('EVM payable contracts', () => {9describe('EVM payable contracts', () => {
55 });55 });
5656
57 itWeb3('Balance can be retrieved from evm contract', async({api, web3}) => {57 itWeb3('Balance can be retrieved from evm contract', async({api, web3}) => {
58 const FEE_BALANCE = 10n ** 18n;58 const FEE_BALANCE = 1000n * UNIQUE;
59 const CONTRACT_BALANCE = 10n ** 14n;59 const CONTRACT_BALANCE = 1n * UNIQUE;
6060
61 const deployer = await createEthAccountWithBalance(api, web3);61 const deployer = await createEthAccountWithBalance(api, web3);
62 const contract = await deployCollector(web3, deployer);62 const contract = await deployCollector(web3, deployer);
modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
30 alice = keyring.addFromUri('//Alice');30 alice = keyring.addFromUri('//Alice');
31 bob = keyring.addFromUri('//Bob');31 bob = keyring.addFromUri('//Bob');
32 shema = '0x31';32 shema = '0x31';
33 largeShema = new Array(4097).fill(0xff);33 largeShema = new Array(1024 * 1024 + 10).fill(0xff);
34
35 });34 });
36});35});
88 });87 });
89 });88 });
9089
91 it('Set invalid data in schema (size too large:> 1024b)', async () => {90 it('Set invalid data in schema (size too large:> 1MB)', async () => {
92 await usingApi(async (api) => {91 await usingApi(async (api) => {
93 const collectionId = await createCollectionExpectSuccess();92 const collectionId = await createCollectionExpectSuccess();
94 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, largeShema);93 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, largeShema);
modifiedtests/src/setOffchainSchema.test.tsdiffbeforeafterboth
84 await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);84 await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);
85 });85 });
8686
87 it('fails on too long data', async () => {87 it.only('fails on too long data', async () => {
88 const tooLongData = new Array(4097).fill(0xff);88 const tooLongData = new Array(8 * 1024 + 10).fill(0xff);
8989
90 await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);90 await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);
91 });91 });
modifiedtests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth
30 alice = keyring.addFromUri('//Alice');30 alice = keyring.addFromUri('//Alice');
31 bob = keyring.addFromUri('//Bob');31 bob = keyring.addFromUri('//Bob');
32 schema = '0x31';32 schema = '0x31';
33 largeSchema = new Array(4097).fill(0xff);33 largeSchema = new Array(8 * 1024 + 10).fill(0xff);
3434
35 });35 });
36});36});
104 });104 });
105 });105 });
106106
107 it('Set invalid data in schema (size too large:> 1024b)', async () => {107 it('Set invalid data in schema (size too large:> 8kB)', async () => {
108 await usingApi(async (api) => {108 await usingApi(async (api) => {
109 const collectionId = await createCollectionExpectSuccess();109 const collectionId = await createCollectionExpectSuccess();
110 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, largeSchema);110 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, largeSchema);