I am trying to test nodejs chaincode without deploying it to a hyperledger fabic network. There is a popular nodejs library called @theledger/fabric-mock-stub. Below is my unit test
const Chaincode = require('./index.js');
// import { ChaincodeMockStub, Transform } from "@theledger/fabric-mock-stub";
const ChaincodeMockStub = require("@theledger/fabric-mock-stub")
// You always need your chaincode so it knows which chaincode to invoke on
const chaincode = new Chaincode();
describe('Test MyChaincode', () => {
it("Should init without issues", async () => {
const mockStub = new ChaincodeMockStub("MyMockStub", chaincode);
const response = await mockStub.mockInit("tx1", []);
expect(response.status).to.eql(200)
});
});
When this test is run the following error is received
2019-04-08T18:34:55.530Z ERROR [lib/chaincode.js] uncaughtException: Missing required argument peer.address
Does anyone know how to use this testing library? https://github.com/wearetheledger/fabric-mock-stub
Any help would be greatly appreciated thanks.
Aucun commentaire:
Enregistrer un commentaire