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

difftreelog

Mint tests generalization

Max Andreev2023-01-13parent: #8a76dd7.patch.diff
in: master

8 files changed

deletedtests/src/eth/collections/callMethodsERC20.test.tsdiffbeforeafterboth

no changes

deletedtests/src/eth/collections/callMethodsERC721.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
29 });29 });
30 });30 });
31
32 itEth('Can perform mint()', async ({helper}) => {
33 const owner = await helper.eth.createAccountWithBalance(donor);
34 const receiver = helper.eth.createAccount();
35 const collection = await helper.ft.mintCollection(alice);
36 await collection.addAdmin(alice, {Ethereum: owner});
37
38 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
39 const contract = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
40
41 const result = await contract.methods.mint(receiver, 100).send();
42
43 const event = result.events.Transfer;
44 expect(event.address).to.equal(collectionAddress);
45 expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
46 expect(event.returnValues.to).to.equal(receiver);
47 expect(event.returnValues.value).to.equal('100');
48 });
4931
50 [32 [
51 'substrate' as const,33 'substrate' as const,
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
88 });88 });
89 });89 });
90
91 itEth('Can perform mint() & get crossOwner()', async ({helper}) => {
92 const owner = await helper.eth.createAccountWithBalance(donor);
93 const receiver = helper.eth.createAccount();
94
95 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', '6', '6', '');
96 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
97
98 const result = await contract.methods.mintWithTokenURI(receiver, 'Test URI').send();
99 const tokenId = result.events.Transfer.returnValues.tokenId;
100 expect(tokenId).to.be.equal('1');
101
102 const event = result.events.Transfer;
103 expect(event.address).to.be.equal(collectionAddress);
104 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');
105 expect(event.returnValues.to).to.be.equal(receiver);
106
107 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
108 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
109 // TODO: this wont work right now, need release 919000 first
110 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
111 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
112 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
113 });
11490
115 // TODO combine all minting tests in one place91 // TODO combine all minting tests in one place
116 [92 [
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
34 });34 });
35 });35 });
36
37 itEth('Can perform mint() & crossOwnerOf()', async ({helper}) => {
38 const owner = await helper.eth.createAccountWithBalance(donor);
39 const receiver = helper.eth.createAccount();
40 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');
41 const contract = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
42
43 const result = await contract.methods.mintWithTokenURI(receiver, 'Test URI').send();
44
45 const event = result.events.Transfer;
46 expect(event.address).to.equal(collectionAddress);
47 expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
48 expect(event.returnValues.to).to.equal(receiver);
49 const tokenId = event.returnValues.tokenId;
50 expect(tokenId).to.be.equal('1');
51
52 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
53 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
54 });
5536
56 [37 [
57 'substrate' as const,38 'substrate' as const,
addedtests/src/eth/tokens/callMethodsERC20.test.tsdiffbeforeafterboth

no changes

addedtests/src/eth/tokens/callMethodsERC721.test.tsdiffbeforeafterboth

no changes

addedtests/src/eth/tokens/minting.test.tsdiffbeforeafterboth

no changes