difftreelog
CORE-302 Move test to separate file
in: master
2 files changed
tests/src/eth/base.test.tsdiffbeforeafterboth--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -15,9 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
import {
- collectionIdFromAddress,
collectionIdToAddress,
- contractHelpers,
createEthAccount,
createEthAccountWithBalance,
deployFlipper,
@@ -28,7 +26,7 @@
usingWeb3,
} from './util/helpers';
import {expect} from 'chai';
-import {createCollectionExpectSuccess, createItemExpectSuccess, getCreatedCollectionCount, getDetailedCollectionInfo, UNIQUE} from '../util/helpers';
+import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';
import nonFungibleAbi from './nonFungibleAbi.json';
import privateKey from '../substrate/privateKey';
import {Contract} from 'web3-eth-contract';
@@ -122,30 +120,5 @@
itWeb3('ERC165 support', async ({web3}) => {
expect(await contract(web3).methods.supportsInterface('0x01ffc9a7').call()).to.be.true;
- });
-});
-
-describe('Create collection from EVM', () => {
- itWeb3('Create collection', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
- const helpers = contractHelpers(web3, owner);
- const collectionName = 'CollectionEVM';
- const description = 'Some description';
- const tokenPrefix = 'token prefix';
-
- const collectionCountBefore = await getCreatedCollectionCount(api);
- const result = await helpers.methods
- .create721Collection(collectionName, description, tokenPrefix)
- .send();
- const collectionCountAfter = await getCreatedCollectionCount(api);
-
- const collectionId = collectionIdFromAddress(result.events[0].raw.topics[2]);
- expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
- expect(collectionId).to.be.eq(collectionCountAfter);
-
- const collection = (await getDetailedCollectionInfo(api, collectionId))!;
- expect(collection.name.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(collectionName);
- expect(collection.description.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(description);
- expect(collection.tokenPrefix.toHuman()).to.be.eq(tokenPrefix);
});
});
tests/src/eth/createCollection.test.tsdiffbeforeafterboth1// 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 {expect} from 'chai';18import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';19import {collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';2021describe('Create collection from EVM', () => {22 itWeb3('Create collection', async ({api, web3}) => {23 const owner = await createEthAccountWithBalance(api, web3);24 const helpers = contractHelpers(web3, owner);25 const collectionName = 'CollectionEVM';26 const description = 'Some description';27 const tokenPrefix = 'token prefix';28 29 const collectionCountBefore = await getCreatedCollectionCount(api);30 const result = await helpers.methods31 .create721Collection(collectionName, description, tokenPrefix)32 .send();33 const collectionCountAfter = await getCreatedCollectionCount(api);34 35 const collectionId = collectionIdFromAddress(result.events[0].raw.topics[2]);36 expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);37 expect(collectionId).to.be.eq(collectionCountAfter);38 39 const collection = (await getDetailedCollectionInfo(api, collectionId))!;40 expect(collection.name.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(collectionName);41 expect(collection.description.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(description);42 expect(collection.tokenPrefix.toHuman()).to.be.eq(tokenPrefix);43 expect(collection.schemaVersion.type).to.be.eq('ImageURL');44 });45});