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.rsdiffbeforeafterboth2259 new_test_ext().execute_with(|| {2259 new_test_ext().execute_with(|| {2260 let origin1 = Origin::signed(1);2260 let origin1 = Origin::signed(1);226122612262 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 }22652265tests/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.tsdiffbeforeafterboth--- a/tests/src/setConstOnChainSchema.test.ts
+++ b/tests/src/setConstOnChainSchema.test.ts
@@ -30,8 +30,7 @@
alice = keyring.addFromUri('//Alice');
bob = keyring.addFromUri('//Bob');
shema = '0x31';
- largeShema = new Array(4097).fill(0xff);
-
+ largeShema = new Array(1024 * 1024 + 10).fill(0xff);
});
});
describe('Integration Test ext. setConstOnChainSchema()', () => {
@@ -88,7 +87,7 @@
});
});
- it('Set invalid data in schema (size too large:> 1024b)', async () => {
+ it('Set invalid data in schema (size too large:> 1MB)', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
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);