Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

fabric-mock-stub problem with creation of chaincodeMockStub instance #21

@hnamzian

Description

@hnamzian

Hi,
I'm trying to test my contract created by IBM blockchain platform VSCIDE extension. My contract is written in typescript. Now in order to test my contract I've used the following code:

import { MyContract } from '../src/my-contract';
import { ChaincodeMockStub, Transform } from "@theledger/fabric-mock-stub";
 
// You always need your chaincode so it knows which chaincode to invoke on
const chaincode = new MyContract();
 
describe('Test MyChaincode', () => {
 
    it("Should init without issues", async () => {
        const mockStub = new ChaincodeMockStub("MyMockStub", chaincode);
 
        // Your test code
    });
});

and I get 2 errors. first I get "Unexpected token import", and second there is an error with the below line:

const mockStub = new ChaincodeMockStub("MyMockStub", chaincode);

says "Argument of type "MyContract" is not assignable to parameter of type "ChaincodeInterface" ".

Thanks for help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions