wearetheledger / fabric-mock-stub

Mock implementation of the fabric-shim stub for testing
https://theledger.be
MIT License
49 stars 28 forks source link

Fix MockStub.getState(key) returns 'undefined' rather than empty bytes. #19

Closed jestersimpps closed 5 years ago

jestersimpps commented 5 years ago

MockStub.getState(key) returns 'undefined' rather than empty bytes which actual node.js chaincode shim returns (as of v1.2.3).

For example if we try to .toString() on the response returned by getState(key) of undefined it throw an error, in order to work we need to add additional if statement to avoid doing operation on undefined variable

https://github.com/wearetheledger/fabric-mock-stub/issues/13

codecov[bot] commented 5 years ago

Codecov Report

Merging #19 into master will decrease coverage by 0.27%. The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
- Coverage    64.5%   64.22%   -0.28%     
==========================================
  Files          11       11              
  Lines         462      464       +2     
  Branches       53       54       +1     
==========================================
  Hits          298      298              
- Misses        136      137       +1     
- Partials       28       29       +1
Impacted Files Coverage Δ
src/ChaincodeMockStub.ts 69.54% <33.33%> (-0.72%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 309afd8...1831857. Read the comment docs.