Skip to content

Commit

Permalink
Update unit tests to include {publish: true}
Browse files Browse the repository at this point in the history
Signed-off-by: Nicko Guyer <[email protected]>
  • Loading branch information
nguyer committed Nov 13, 2023
1 parent baacca9 commit d77c7de
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
34 changes: 22 additions & 12 deletions server/test/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Smart Contracts', () => {
.expect(202)
.expect({ type: 'message', id: 'msg1' });

expect(mockFireFly.createContractInterface).toHaveBeenCalledWith(req.schema);
expect(mockFireFly.createContractInterface).toHaveBeenCalledWith(req.schema, { publish: true });
});

test('Create contract interface from ABI', async () => {
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Smart Contracts', () => {
version: '1.0',
input: { abi: req.schema },
});
expect(mockFireFly.createContractInterface).toHaveBeenCalledWith(int);
expect(mockFireFly.createContractInterface).toHaveBeenCalledWith(int, { publish: true });
});

test('Create contract API', async () => {
Expand All @@ -94,11 +94,16 @@ describe('Smart Contracts', () => {
.expect(202)
.expect({ type: 'message', id: 'msg1' });

expect(mockFireFly.createContractAPI).toHaveBeenCalledWith({
interface: { name: 'my-contract', version: '1.0' },
location: { address: '0x123' },
name: 'my-api',
});
expect(mockFireFly.createContractAPI).toHaveBeenCalledWith(
{
interface: { name: 'my-contract', version: '1.0' },
location: { address: '0x123' },
name: 'my-api',
},
{
publish: true,
},
);
});

test('Create contract API with Fabric', async () => {
Expand All @@ -122,11 +127,16 @@ describe('Smart Contracts', () => {
.expect(202)
.expect({ type: 'message', id: 'msg1' });

expect(mockFireFly.createContractAPI).toHaveBeenCalledWith({
interface: { name: 'my-contract', version: '1.0' },
location: { chaincode: 'chaincode', channel: '0x123' },
name: 'my-api-fabric',
});
expect(mockFireFly.createContractAPI).toHaveBeenCalledWith(
{
interface: { name: 'my-contract', version: '1.0' },
location: { chaincode: 'chaincode', channel: '0x123' },
name: 'my-api-fabric',
},
{
publish: true,
},
);
});

test('Get contract Interfaces', async () => {
Expand Down
17 changes: 11 additions & 6 deletions server/test/tokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ describe('Tokens', () => {
.expect(202)
.expect({ type: 'token_pool', id: 'pool1' });

expect(mockFireFly.createTokenPool).toHaveBeenCalledWith({
name: 'my-pool',
symbol: 'P1',
type: 'fungible',
config: {},
});
expect(mockFireFly.createTokenPool).toHaveBeenCalledWith(
{
name: 'my-pool',
symbol: 'P1',
type: 'fungible',
config: {},
},
{
publish: true,
},
);
});

test('Mint tokens', async () => {
Expand Down

0 comments on commit d77c7de

Please sign in to comment.