git.delta.rocks / unique-network / refs/commits / f15380e36126

difftreelog

CORE-302 Move test to separate file

Trubnikov Sergey2022-04-18parent: #0dc93c7.patch.diff
in: master

2 files changed

modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {17import {
18 collectionIdFromAddress,
19 collectionIdToAddress, 18 collectionIdToAddress,
20 contractHelpers,
21 createEthAccount, 19 createEthAccount,
22 createEthAccountWithBalance, 20 createEthAccountWithBalance,
23 deployFlipper, 21 deployFlipper,
28 usingWeb3,26 usingWeb3,
29} from './util/helpers';27} from './util/helpers';
30import {expect} from 'chai';28import {expect} from 'chai';
31import {createCollectionExpectSuccess, createItemExpectSuccess, getCreatedCollectionCount, getDetailedCollectionInfo, UNIQUE} from '../util/helpers';29import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';
32import nonFungibleAbi from './nonFungibleAbi.json';30import nonFungibleAbi from './nonFungibleAbi.json';
33import privateKey from '../substrate/privateKey';31import privateKey from '../substrate/privateKey';
34import {Contract} from 'web3-eth-contract';32import {Contract} from 'web3-eth-contract';
125 });123 });
126});124});
127
128describe('Create collection from EVM', () => {
129 itWeb3('Create collection', async ({api, web3}) => {
130 const owner = await createEthAccountWithBalance(api, web3);
131 const helpers = contractHelpers(web3, owner);
132 const collectionName = 'CollectionEVM';
133 const description = 'Some description';
134 const tokenPrefix = 'token prefix';
135
136 const collectionCountBefore = await getCreatedCollectionCount(api);
137 const result = await helpers.methods
138 .create721Collection(collectionName, description, tokenPrefix)
139 .send();
140 const collectionCountAfter = await getCreatedCollectionCount(api);
141
142 const collectionId = collectionIdFromAddress(result.events[0].raw.topics[2]);
143 expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
144 expect(collectionId).to.be.eq(collectionCountAfter);
145
146 const collection = (await getDetailedCollectionInfo(api, collectionId))!;
147 expect(collection.name.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(collectionName);
148 expect(collection.description.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(description);
149 expect(collection.tokenPrefix.toHuman()).to.be.eq(tokenPrefix);
150 });
151});
152125
addedtests/src/eth/createCollection.test.tsdiffbeforeafterboth

no changes