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.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.tsdiffbeforeafterboth30 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);343435 });35 });36});36});104 });104 });105 });105 });106106107 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);