git.delta.rocks / unique-network / refs/commits / 3a3ad6b3e842

difftreelog

chore fix test formating

Grigoriy Simonov2022-10-25parent: #b3ce401.patch.diff
in: master

4 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -14,7 +14,6 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {IKeyringPair} from '@polkadot/types/types';
-import {IEthCrossAccountId} from '../util/playgrounds/types';
 import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util';
 
 async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise<any>) {
modifiedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -15,7 +15,7 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {IKeyringPair} from '@polkadot/types/types';
-import { evmToAddress } from '@polkadot/util-crypto';
+import {evmToAddress} from '@polkadot/util-crypto';
 import {Pallets, requirePalletsOrSkip} from '../util';
 import {expect, itEth, usingEthPlaygrounds} from './util';
 
@@ -27,7 +27,7 @@
   before(async function() {
     await usingEthPlaygrounds(async (helper, privateKey) => {
       requirePalletsOrSkip(this, helper, [Pallets.Fungible]);
-      donor = await privateKey('//Alice');
+      donor = await privateKey({filename: __filename});
     });
   });
 
@@ -181,7 +181,7 @@
   before(async function() {
     await usingEthPlaygrounds(async (helper, privateKey) => {
       requirePalletsOrSkip(this, helper, [Pallets.Fungible]);
-      donor = await privateKey('//Alice');
+      donor = await privateKey({filename: __filename});
       nominal = helper.balance.getOneTokenNominal();
     });
   });
modifiedtests/src/eth/destroyCollection.test.tsdiffbeforeafterboth
before · tests/src/eth/destroyCollection.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.8//9// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {Pallets, requirePalletsOrSkip} from '../util';19import {expect, itEth, usingEthPlaygrounds} from './util';202122describe('Destroy Collection from EVM', () => {23  let donor: IKeyringPair;2425  before(async function() {26    await usingEthPlaygrounds(async (helper, privateKey) => {27      requirePalletsOrSkip(this, helper, [Pallets.ReFungible, Pallets.NFT]);28      donor = await privateKey('//Alice');29    });30  });3132  33  itEth('(!negative test!) RFT', async ({helper}) => {34    const owner = await helper.eth.createAccountWithBalance(donor);35    const signer = await helper.eth.createAccountWithBalance(donor);36    37    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);38    39    const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');40    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);41    42    await expect(collectionHelper.methods43      .destroyCollection(collectionAddress)44      .send({from: signer})).to.be.rejected;45    46    await expect(collectionHelper.methods47      .destroyCollection(unexistedCollection)48      .send({from: signer})).to.be.rejected;49    50    expect(await collectionHelper.methods51      .isCollectionExist(unexistedCollection)52      .call()).to.be.false;53  });54  55  itEth('(!negative test!) NFT', async ({helper}) => {56    const owner = await helper.eth.createAccountWithBalance(donor);57    const signer = await helper.eth.createAccountWithBalance(donor);58    59    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);60    61    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');62    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);63    64    await expect(collectionHelper.methods65      .destroyCollection(collectionAddress)66      .send({from: signer})).to.be.rejected;67    68    await expect(collectionHelper.methods69      .destroyCollection(unexistedCollection)70      .send({from: signer})).to.be.rejected;71    72    expect(await collectionHelper.methods73      .isCollectionExist(unexistedCollection)74      .call()).to.be.false;75  });76});
after · tests/src/eth/destroyCollection.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.8//9// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {Pallets, requirePalletsOrSkip} from '../util';19import {expect, itEth, usingEthPlaygrounds} from './util';202122describe('Destroy Collection from EVM', () => {23  let donor: IKeyringPair;2425  before(async function() {26    await usingEthPlaygrounds(async (helper, privateKey) => {27      requirePalletsOrSkip(this, helper, [Pallets.ReFungible, Pallets.NFT]);28      donor = await privateKey({filename: __filename});29    });30  });3132  33  itEth('(!negative test!) RFT', async ({helper}) => {34    const owner = await helper.eth.createAccountWithBalance(donor);35    const signer = await helper.eth.createAccountWithBalance(donor);36    37    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);38    39    const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');40    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);41    42    await expect(collectionHelper.methods43      .destroyCollection(collectionAddress)44      .send({from: signer})).to.be.rejected;45    46    await expect(collectionHelper.methods47      .destroyCollection(unexistedCollection)48      .send({from: signer})).to.be.rejected;49    50    expect(await collectionHelper.methods51      .isCollectionExist(unexistedCollection)52      .call()).to.be.false;53  });54  55  itEth('(!negative test!) NFT', async ({helper}) => {56    const owner = await helper.eth.createAccountWithBalance(donor);57    const signer = await helper.eth.createAccountWithBalance(donor);58    59    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);60    61    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');62    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);63    64    await expect(collectionHelper.methods65      .destroyCollection(collectionAddress)66      .send({from: signer})).to.be.rejected;67    68    await expect(collectionHelper.methods69      .destroyCollection(unexistedCollection)70      .send({from: signer})).to.be.rejected;71    72    expect(await collectionHelper.methods73      .isCollectionExist(unexistedCollection)74      .call()).to.be.false;75  });76});
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -7,7 +7,7 @@
 
 import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';
 import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';
-import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm, base58Encode, blake2AsU8a} from '@polkadot/util-crypto';
+import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';
 import {IKeyringPair} from '@polkadot/types/types';
 import {
   IApiListeners,
@@ -33,15 +33,12 @@
   TEthereumAccount,
   TSigner,
   TSubstrateAccount,
-  IEthCrossAccountId,
   TNetworks,
   IForeignAssetMetadata,
   AcalaAssetMetadata,
   MoonbeamAssetInfo,
   DemocracyStandardAccountVote,
 } from './types';
-import {hexToU8a} from '@polkadot/util/hex';
-import {u8aConcat} from '@polkadot/util/u8a';
 
 export class CrossAccountId implements ICrossAccountId {
   Substrate?: TSubstrateAccount;