git.delta.rocks / unique-network / refs/commits / 12a37a0aa8c3

difftreelog

Update contracts tests

Greg Zaitsev2020-12-25parent: #dc63ebc.patch.diff
in: master

2 files changed

modifiedtests/src/contracts.test.tsdiffbeforeafterboth
--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -89,14 +89,15 @@
   return (result.result.asSuccess.data[0] == 0x00) ? false : true;
 }
 
-describe('Contracts smoke test', () => {
+describe('Contracts', () => {
   it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {
     await usingApi(async api => {
       const [contract, deployer] = await deployFlipper(api);
       const initialGetResponse = await getFlipValue(contract, deployer);
 
+      const bob = privateKey("//Bob");
       const flip = contract.exec('flip', value, gasLimit);
-      await submitTransactionAsync(deployer, flip);
+      await submitTransactionAsync(bob, flip);
 
       const afterFlipGetResponse = await getFlipValue(contract, deployer);
       expect(afterFlipGetResponse).not.to.be.eq(initialGetResponse, 'Flipping should change value.');
modifiedtests/src/createItem.test.tsdiffbeforeafterboth
before · tests/src/createItem.test.ts
1import { assert } from 'chai';
2import { alicesPublicKey } from './accounts';
3import privateKey from './substrate/privateKey';
4import { default as usingApi } from './substrate/substrate-api';
5import waitNewBlocks from './substrate/wait-new-blocks';
6import { 
7  createCollectionExpectSuccess, 
8  createItemExpectSuccess
9} from './util/helpers';
10
11describe.only('integration test: ext. createItem():', () => {
12  it('Create new item in NFT collection', async () => {
13    const createMode = 'NFT';
14    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
15    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
16  });
17  it('Create new item in Fungible collection', async () => {
18    const createMode = 'Fungible';
19    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
20    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
21  });
22  it('Create new item in ReFungible collection', async () => {
23    const createMode = 'ReFungible';
24    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
25    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
26  });
27});
after · tests/src/createItem.test.ts
1import { assert } from 'chai';
2import { alicesPublicKey } from './accounts';
3import privateKey from './substrate/privateKey';
4import { default as usingApi } from './substrate/substrate-api';
5import waitNewBlocks from './substrate/wait-new-blocks';
6import { 
7  createCollectionExpectSuccess, 
8  createItemExpectSuccess
9} from './util/helpers';
10
11describe('integration test: ext. createItem():', () => {
12  it('Create new item in NFT collection', async () => {
13    const createMode = 'NFT';
14    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
15    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
16  });
17  it('Create new item in Fungible collection', async () => {
18    const createMode = 'Fungible';
19    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
20    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
21  });
22  it('Create new item in ReFungible collection', async () => {
23    const createMode = 'ReFungible';
24    const newCollectionID = await createCollectionExpectSuccess('0', '0', '0', createMode);
25    await createItemExpectSuccess(newCollectionID, createMode, '//Alice');
26  });
27});