From dd8799e9dd7091e00ecd9196a16165d6bf4793bd Mon Sep 17 00:00:00 2001 From: lesleyannj Date: Sun, 5 Jan 2020 19:33:22 +0000 Subject: [PATCH] FABCN-241 Remove to.be.ok Signed-off-by: lesleyannj --- libraries/fabric-shim/test/unit/stub.js | 78 ++++++++++++------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/libraries/fabric-shim/test/unit/stub.js b/libraries/fabric-shim/test/unit/stub.js index dc837344..ccba16ed 100644 --- a/libraries/fabric-shim/test/unit/stub.js +++ b/libraries/fabric-shim/test/unit/stub.js @@ -414,17 +414,17 @@ describe('Stub', () => { }); expect(stub.binding).to.deep.equal('some proposal binding'); - expect(_proposalProtoProposalDecodeStub.calledOnce).to.be.ok; + expect(_proposalProtoProposalDecodeStub.calledOnce).to.be.true; expect(_proposalProtoProposalDecodeStub.firstCall.args).to.deep.equal(['some bytes']); - expect(_commonProtoHeaderDecodeStub.calledOnce).to.be.ok; + expect(_commonProtoHeaderDecodeStub.calledOnce).to.be.true; expect(_commonProtoHeaderDecodeStub.firstCall.args).to.deep.equal([decodedProposal.header]); - expect(_commonProtoSignatureHeaderDecodeStub.calledOnce).to.be.ok; + expect(_commonProtoSignatureHeaderDecodeStub.calledOnce).to.be.true; expect(_commonProtoSignatureHeaderDecodeStub.firstCall.args).to.deep.equal([decodedHeader.signatureHeader]); - expect(_idProtoSerializedIdentityDecodeStub.calledOnce).to.be.ok; + expect(_idProtoSerializedIdentityDecodeStub.calledOnce).to.be.true; expect(_idProtoSerializedIdentityDecodeStub.firstCall.args).to.deep.equal([decodedSigHeader.creator]); - expect(_commonProtoChannelHeaderDecodeStub.calledOnce).to.be.ok; + expect(_commonProtoChannelHeaderDecodeStub.calledOnce).to.be.true; expect(_commonProtoChannelHeaderDecodeStub.firstCall.args).to.deep.equal([decodedHeader.channelHeader]); - expect(_proposalProtoChaincodeProposalPayloadDecodeStub.calledOnce).to.be.ok; + expect(_proposalProtoChaincodeProposalPayloadDecodeStub.calledOnce).to.be.true; expect(_proposalProtoChaincodeProposalPayloadDecodeStub.firstCall.args).to.deep.equal([decodedProposal.payload]); Stub.__set__('computeProposalBinding', saveComputeProposalBinding); @@ -625,7 +625,7 @@ describe('Stub', () => { const result = await stub.getState('a key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateStub.calledOnce).to.be.ok; + expect(handleGetStateStub.calledOnce).to.be.true; expect(handleGetStateStub.firstCall.args).to.deep.equal(['', 'a key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -643,7 +643,7 @@ describe('Stub', () => { const result = await stub.putState('a key', 'a value'); expect(result).to.deep.equal('some state'); - expect(handlePutStateStub.calledOnce).to.be.ok; + expect(handlePutStateStub.calledOnce).to.be.true; expect(handlePutStateStub.firstCall.args).to.deep.equal(['', 'a key', Buffer.from('a value'), 'dummyChannelId', 'dummyTxid']); }); it ('should return handler.handlePutState', async () => { @@ -658,7 +658,7 @@ describe('Stub', () => { const result = await stub.putState('a key', {a:'value'}); expect(result).to.deep.equal('some state'); - expect(handlePutStateStub.calledOnce).to.be.ok; + expect(handlePutStateStub.calledOnce).to.be.true; expect(handlePutStateStub.firstCall.args).to.deep.equal(['', 'a key', {a:'value'}, 'dummyChannelId', 'dummyTxid']); }); }); @@ -676,7 +676,7 @@ describe('Stub', () => { const result = await stub.deleteState('a key'); expect(result).to.deep.equal('some state'); - expect(handleDeleteStateStub.calledOnce).to.be.ok; + expect(handleDeleteStateStub.calledOnce).to.be.true; expect(handleDeleteStateStub.firstCall.args).to.deep.equal(['', 'a key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -726,7 +726,7 @@ describe('Stub', () => { const result = await stub.getStateByRange('start key', 'end key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; expect(handleGetStateByRangeStub.firstCall.args).to.deep.equal(['', 'start key', 'end key', 'dummyChannelId', 'dummyTxid']); }); @@ -744,7 +744,7 @@ describe('Stub', () => { const result = await stub.getStateByRange(null, 'end key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; expect(handleGetStateByRangeStub.firstCall.args).to.deep.equal(['', EMPTY_KEY_SUBSTITUTE, 'end key', 'dummyChannelId', 'dummyTxid']); }); @@ -797,7 +797,7 @@ describe('Stub', () => { const result = await stub.getStateByRangeWithPagination(null, 'end key', 3); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; const metadataBuffer = fabprotos.protos.QueryResponseMetadata.encode({ bookmark: '', fetchedRecordsCount: 3 @@ -817,7 +817,7 @@ describe('Stub', () => { const result = await stub.getStateByRangeWithPagination('start key', 'end key', 3); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; const metadataBuffer = fabprotos.protos.QueryResponseMetadata.encode({ bookmark: '', fetchedRecordsCount: 3 @@ -837,7 +837,7 @@ describe('Stub', () => { const result = await stub.getStateByRangeWithPagination('start key', 'end key', 3, 'a bookmark'); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; const metadataBuffer = fabprotos.protos.QueryResponseMetadata.encode({ bookmark: 'a bookmark', fetchedRecordsCount: 3 @@ -859,7 +859,7 @@ describe('Stub', () => { const result = await stub.getQueryResult('a query'); expect(result).to.deep.equal('some query result'); - expect(handleGetQueryResultStub.calledOnce).to.be.ok; + expect(handleGetQueryResultStub.calledOnce).to.be.true; expect(handleGetQueryResultStub.firstCall.args).to.deep.equal(['', 'a query', null, 'dummyChannelId', 'dummyTxid']); }); }); @@ -877,7 +877,7 @@ describe('Stub', () => { const result = await stub.getQueryResultWithPagination('a query', 3); expect(result).to.deep.equal('some query result'); - expect(handleGetQueryResultStub.calledOnce).to.be.ok; + expect(handleGetQueryResultStub.calledOnce).to.be.true; const metadata = handleGetQueryResultStub.firstCall.args[2]; const decoded = fabprotos.protos.QueryMetadata.decode(metadata); expect(decoded.pageSize).to.equal(3); @@ -896,7 +896,7 @@ describe('Stub', () => { const result = await stub.getQueryResultWithPagination('a query', 3, 'a bookmark'); expect(result).to.deep.equal('some query result'); - expect(handleGetQueryResultStub.calledOnce).to.be.ok; + expect(handleGetQueryResultStub.calledOnce).to.be.true; const metadata = handleGetQueryResultStub.firstCall.args[2]; const decoded = fabprotos.protos.QueryMetadata.decode(metadata); expect(decoded.pageSize).to.equal(3); @@ -917,7 +917,7 @@ describe('Stub', () => { const result = await stub.getHistoryForKey('a key'); expect(result).to.deep.equal('some history'); - expect(handleGetHistoryForKeyStub.calledOnce).to.be.ok; + expect(handleGetHistoryForKeyStub.calledOnce).to.be.true; expect(handleGetHistoryForKeyStub.firstCall.args).to.deep.equal(['a key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -940,7 +940,7 @@ describe('Stub', () => { const result = await stub.invokeChaincode('chaincodeName', ['some', 'args'], 'someChannel'); expect(result).to.deep.equal('invoked'); - expect(handleInvokeChaincodeStub.calledOnce).to.be.ok; + expect(handleInvokeChaincodeStub.calledOnce).to.be.true; expect(handleInvokeChaincodeStub.firstCall.args).to.deep.equal(['chaincodeName/someChannel', ['some', 'args'], 'dummyChannelId', 'dummyTxid']); }); @@ -948,7 +948,7 @@ describe('Stub', () => { const result = await stub.invokeChaincode('chaincodeName', ['some', 'args']); expect(result).to.deep.equal('invoked'); - expect(handleInvokeChaincodeStub.calledOnce).to.be.ok; + expect(handleInvokeChaincodeStub.calledOnce).to.be.true; expect(handleInvokeChaincodeStub.firstCall.args).to.deep.equal(['chaincodeName', ['some', 'args'], 'dummyChannelId', 'dummyTxid']); }); }); @@ -1003,7 +1003,7 @@ describe('Stub', () => { expect(() => { stub.createCompositeKey('some type', 'some attributes'); }).to.throw(/attributes must be an array/); - expect(mockValidate.calledOnce).to.be.ok; + expect(mockValidate.calledOnce).to.be.true; expect(mockValidate.firstCall.args).to.deep.equal(['some type']); }); @@ -1014,7 +1014,7 @@ describe('Stub', () => { const result = stub.createCompositeKey('some type', ['attr1', 'attr2']); expect(result).to.deep.equal(`${COMPOSITEKEY_NS}some type${MIN_UNICODE_RUNE_VALUE}attr1${MIN_UNICODE_RUNE_VALUE}attr2${MIN_UNICODE_RUNE_VALUE}`); - expect(mockValidate.calledThrice).to.be.ok; + expect(mockValidate.calledThrice).to.be.true; expect(mockValidate.firstCall.args).to.deep.equal(['some type']); expect(mockValidate.secondCall.args).to.deep.equal(['attr1']); expect(mockValidate.thirdCall.args).to.deep.equal(['attr2']); @@ -1070,9 +1070,9 @@ describe('Stub', () => { const result = await stub.getStateByPartialCompositeKey('some type', ['attr1', 'attr2']); expect(result).to.deep.equal('some state'); - expect(createCompositeKeyStub.calledOnce).to.be.ok; + expect(createCompositeKeyStub.calledOnce).to.be.true; expect(createCompositeKeyStub.firstCall.args).to.deep.equal(['some type', ['attr1', 'attr2']]); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; expect(handleGetStateByRangeStub.firstCall.args).to.deep.equal(['', 'some composite key', `some composite key${MAX_UNICODE_RUNE_VALUE}`, 'dummyChannelId', 'dummyTxid']); }); }); @@ -1097,9 +1097,9 @@ describe('Stub', () => { const result = await stub.getStateByPartialCompositeKeyWithPagination('some type', ['attr1', 'attr2'], 3); expect(result).to.deep.equal(response); - expect(createCompositeKeyStub.calledOnce).to.be.ok; + expect(createCompositeKeyStub.calledOnce).to.be.true; expect(createCompositeKeyStub.firstCall.args).to.deep.equal(['some type', ['attr1', 'attr2']]); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; const metadata = handleGetStateByRangeStub.firstCall.args[5]; const decoded = fabprotos.protos.QueryMetadata.decode(metadata); expect(decoded.pageSize).to.equal(3); @@ -1116,9 +1116,9 @@ describe('Stub', () => { const createCompositeKeyStub = sinon.stub(stub, 'createCompositeKey').returns('some composite key'); const result = await stub.getStateByPartialCompositeKeyWithPagination('some type', ['attr1', 'attr2'], 23, 'a bookmark'); expect(result).to.deep.equal(response); - expect(createCompositeKeyStub.calledOnce).to.be.ok; + expect(createCompositeKeyStub.calledOnce).to.be.true; expect(createCompositeKeyStub.firstCall.args).to.deep.equal(['some type', ['attr1', 'attr2']]); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; const metadata = handleGetStateByRangeStub.firstCall.args[5]; const decoded = fabprotos.protos.QueryMetadata.decode(metadata); expect(decoded.pageSize).to.equal(23); @@ -1158,7 +1158,7 @@ describe('Stub', () => { const result = await stub.getPrivateData('some collection', 'some key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateStub.calledOnce).to.be.ok; + expect(handleGetStateStub.calledOnce).to.be.true; expect(handleGetStateStub.firstCall.args).to.deep.equal(['some collection', 'some key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -1195,7 +1195,7 @@ describe('Stub', () => { const result = await stub.getPrivateDataHash('some collection', 'some key'); expect(result).to.deep.equal('some state'); - expect(handleGetPrivateDataHashStub.calledOnce).to.be.ok; + expect(handleGetPrivateDataHashStub.calledOnce).to.be.true; expect(handleGetPrivateDataHashStub.firstCall.args).to.deep.equal(['some collection', 'some key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -1241,7 +1241,7 @@ describe('Stub', () => { it ('should return handler.handlePutState with string', async () => { const result = await stub.putPrivateData('some collection', 'some key', 'some value'); expect(result).to.deep.equal('some state'); - expect(handlePutStateStub.calledOnce).to.be.ok; + expect(handlePutStateStub.calledOnce).to.be.true; expect(handlePutStateStub.firstCall.args).to.deep.equal(['some collection', 'some key', Buffer.from('some value'), 'dummyChannelId', 'dummyTxid']); }); @@ -1249,7 +1249,7 @@ describe('Stub', () => { const result = await stub.putPrivateData('some collection', 'some key', {some :'value'}); expect(result).to.deep.equal('some state'); - expect(handlePutStateStub.calledOnce).to.be.ok; + expect(handlePutStateStub.calledOnce).to.be.true; expect(handlePutStateStub.firstCall.args).to.deep.equal(['some collection', 'some key', {some :'value'}, 'dummyChannelId', 'dummyTxid']); }); }); @@ -1286,7 +1286,7 @@ describe('Stub', () => { const result = await stub.deletePrivateData('some collection', 'some key'); expect(result).to.deep.equal('some state'); - expect(handleDeleteStateStub.calledOnce).to.be.ok; + expect(handleDeleteStateStub.calledOnce).to.be.true; expect(handleDeleteStateStub.firstCall.args).to.deep.equal(['some collection', 'some key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -1362,7 +1362,7 @@ describe('Stub', () => { const result = await stub.getPrivateDataByRange('some collection', null, 'some end key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; expect(handleGetStateByRangeStub.firstCall.args).to.deep.equal(['some collection', EMPTY_KEY_SUBSTITUTE, 'some end key', 'dummyChannelId', 'dummyTxid']); }); @@ -1370,7 +1370,7 @@ describe('Stub', () => { const result = await stub.getPrivateDataByRange('some collection', 'some start key', 'some end key'); expect(result).to.deep.equal('some state'); - expect(handleGetStateByRangeStub.calledOnce).to.be.ok; + expect(handleGetStateByRangeStub.calledOnce).to.be.true; expect(handleGetStateByRangeStub.firstCall.args).to.deep.equal(['some collection', 'some start key', 'some end key', 'dummyChannelId', 'dummyTxid']); }); }); @@ -1413,9 +1413,9 @@ describe('Stub', () => { const result = await stub.getPrivateDataByPartialCompositeKey('some collection', 'some type', ['arg1', 'arg2']); expect(result).to.deep.equal('some data by range'); - expect(createCompositeKeyStub.calledOnce).to.be.ok; + expect(createCompositeKeyStub.calledOnce).to.be.true; expect(createCompositeKeyStub.firstCall.args).to.deep.equal(['some type', ['arg1', 'arg2']]); - expect(getPrivateDataByRangeStub.calledOnce).to.be.ok; + expect(getPrivateDataByRangeStub.calledOnce).to.be.true; expect(getPrivateDataByRangeStub.firstCall.args).to.deep.equal(['some collection', 'some composite key', `some composite key${MAX_UNICODE_RUNE_VALUE}`]); }); }); @@ -1452,7 +1452,7 @@ describe('Stub', () => { const result = await stub.getPrivateDataQueryResult('some collection', 'some query'); expect(result).to.deep.equal('some query result'); - expect(handleGetQueryResultStub.calledOnce).to.be.ok; + expect(handleGetQueryResultStub.calledOnce).to.be.true; expect(handleGetQueryResultStub.firstCall.args).to.deep.equal(['some collection', 'some query', null, 'dummyChannelId', 'dummyTxid']); }); });