Skip to content

Commit 906d605

Browse files
committed
[DONE] ecosystem.js
1 parent 4217aee commit 906d605

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

cc/golang/ecosystem.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as helper from '../../app/helper.js';
22
import {installAndApprove, commit, getContract} from '../testutil.js';
3+
import assert from 'assert';
34

45
const chaincodeID = 'ecosystem';
56
const orderers = helper.newOrderers();
@@ -24,13 +25,27 @@ describe('deploy', function () {
2425
describe('invoke', function () {
2526
this.timeout(0);
2627
const contract = getContract(chaincodeID);
28+
const transientMap = {
29+
token: 'secret'
30+
};
2731
it('CreateToken', async () => {
28-
try {
29-
await contract.submitTransaction('CreateToken', JSON.stringify({Owner: 'icddMSP', MintTime: new Date()}));
30-
} catch (e) {
31-
console.error(e);
32-
}
33-
32+
await contract.submit(['CreateToken', JSON.stringify({Owner: 'David'})], transientMap);
33+
await assert.rejects(contract.submit(['CreateToken', JSON.stringify({Owner: 'David'})], transientMap));
34+
});
35+
it('GetToken', async () => {
36+
const tokenData = await contract.evaluate(['GetToken'], transientMap);
37+
console.info(tokenData);
38+
});
39+
it('MoveToken', async () => {
40+
await contract.submit(['MoveToken', JSON.stringify({Owner: 'Chloe', OwnerType: 'network'})], transientMap);
41+
});
42+
it('TokenHistory', async () => {
43+
const history = await contract.evaluate(['TokenHistory'], transientMap);
44+
console.info(JSON.parse(history));
3445

3546
});
47+
it('DeleteToken', async () => {
48+
await contract.submit(['DeleteToken'], transientMap);
49+
});
50+
3651
});

0 commit comments

Comments
 (0)