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

fix: prove options was set as a string #387

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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