Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
fix: prove options was set as a string (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
jawid-h authored Jul 14, 2021
1 parent c21fd32 commit 8447883
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions lib/externalApis/drive/DriveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class DriveClient {
data: encodedData.toString('hex'),
};

if (prove === true) {
requestOptions.prove = 'true';
}
requestOptions.prove = prove;

const { result, error } = await this.client.request(
'abci_query',
Expand Down
12 changes: 7 additions & 5 deletions test/unit/externalApis/drive/DriveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('DriveClient', () => {
expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', {
path: '/dataContracts',
data: cbor.encode({ id: contractId }).toString('hex'), // cbor encoded empty object
prove: 'true',
prove: true,
});
expect(result).to.be.deep.equal(buffer);
});
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('DriveClient', () => {
expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', {
path: '/dataContracts/documents',
data: cbor.encode({ ...options, contractId, type }).toString('hex'), // cbor encoded empty object
prove: 'true',
prove: true,
});
expect(result).to.be.deep.equal(buffer);
});
Expand All @@ -158,7 +158,8 @@ describe('DriveClient', () => {

expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', {
path: '/identities',
data: cbor.encode({ id: identityId }).toString('hex'), // cbor encoded empty object
data: cbor.encode({ id: identityId }).toString('hex'),
prove: false, // cbor encoded empty object
});
expect(result).to.be.deep.equal(buffer);
});
Expand Down Expand Up @@ -186,7 +187,7 @@ describe('DriveClient', () => {
expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', {
path: '/identities/by-public-key-hash',
data: cbor.encode({ publicKeyHashes }).toString('hex'),
prove: 'true',
prove: true,
});
expect(result).to.be.deep.equal(buffer);
});
Expand All @@ -213,7 +214,7 @@ describe('DriveClient', () => {
expect(drive.client.request).to.have.been.calledOnceWithExactly('abci_query', {
path: '/identities/by-public-key-hash/id',
data: cbor.encode({ publicKeyHashes }).toString('hex'),
prove: 'true',
prove: true,
});
expect(result).to.be.deep.equal(buffer);
});
Expand Down Expand Up @@ -246,6 +247,7 @@ describe('DriveClient', () => {
identityIds,
dataContractIds,
}).toString('hex'),
prove: false,
});

expect(result).to.be.deep.equal({
Expand Down

0 comments on commit 8447883

Please sign in to comment.