difftreelog
Merge pull request #258 from UniqueNetwork/fix/unit_tests
in: master
Unit tests fixed
6 files changed
pallets/unique/src/mock.rsdiffbeforeafterboth--- a/pallets/unique/src/mock.rs
+++ b/pallets/unique/src/mock.rs
@@ -193,6 +193,7 @@
}
impl pallet_template::Config for Test {
+ type Event = ();
type WeightInfo = ();
}
pallets/unique/src/tests.rsdiffbeforeafterboth--- a/pallets/unique/src/tests.rs
+++ b/pallets/unique/src/tests.rs
@@ -2259,7 +2259,7 @@
new_test_ext().execute_with(|| {
let origin1 = Origin::signed(1);
- for i in 1..COLLECTION_NUMBER_LIMIT {
+ for i in 1..=COLLECTION_NUMBER_LIMIT {
create_test_collection(&CollectionMode::NFT, CollectionId(i));
}
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -3,7 +3,7 @@
import {submitTransactionAsync} from '../substrate/substrate-api';
import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';
import {evmToAddress} from '@polkadot/util-crypto';
-import {getGenericResult} from '../util/helpers';
+import {getGenericResult, UNIQUE} from '../util/helpers';
import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';
describe('EVM payable contracts', () => {
@@ -55,8 +55,8 @@
});
itWeb3('Balance can be retrieved from evm contract', async({api, web3}) => {
- const FEE_BALANCE = 10n ** 18n;
- const CONTRACT_BALANCE = 10n ** 14n;
+ const FEE_BALANCE = 1000n * UNIQUE;
+ const CONTRACT_BALANCE = 1n * UNIQUE;
const deployer = await createEthAccountWithBalance(api, web3);
const contract = await deployCollector(web3, deployer);
tests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth30 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);3435 });34 });36});35});88 });87 });89 });88 });908991 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);tests/src/setOffchainSchema.test.tsdiffbeforeafterboth--- a/tests/src/setOffchainSchema.test.ts
+++ b/tests/src/setOffchainSchema.test.ts
@@ -84,8 +84,8 @@
await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);
});
- it('fails on too long data', async () => {
- const tooLongData = new Array(4097).fill(0xff);
+ it.only('fails on too long data', async () => {
+ const tooLongData = new Array(8 * 1024 + 10).fill(0xff);
await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);
});
tests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth--- a/tests/src/setVariableOnChainSchema.test.ts
+++ b/tests/src/setVariableOnChainSchema.test.ts
@@ -30,7 +30,7 @@
alice = keyring.addFromUri('//Alice');
bob = keyring.addFromUri('//Bob');
schema = '0x31';
- largeSchema = new Array(4097).fill(0xff);
+ largeSchema = new Array(8 * 1024 + 10).fill(0xff);
});
});
@@ -104,7 +104,7 @@
});
});
- it('Set invalid data in schema (size too large:> 1024b)', async () => {
+ it('Set invalid data in schema (size too large:> 8kB)', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, largeSchema);