aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/test
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-01-09 08:57:59 +0800
committerGitHub <noreply@github.com>2018-01-09 08:57:59 +0800
commit7a56e83fa3ca02d796deba3359da480834a9f6ea (patch)
tree41cf689624c493d47f669421f63392cb36107915 /packages/connect/test
parent35e0b6143ab1405259471e1c9c698bfcd869df5a (diff)
parenta1c38d9cb2da75915248c7bad0d0e13523db389c (diff)
downloaddexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar.gz
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar.bz2
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar.lz
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar.xz
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.tar.zst
dexon-sol-tools-7a56e83fa3ca02d796deba3359da480834a9f6ea.zip
Merge pull request #296 from 0xProject/fix/mutatedInput
Prevent getFeesAsync method on HttpClient from mutating input
Diffstat (limited to 'packages/connect/test')
-rw-r--r--packages/connect/test/http_client_test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts
index 72d6ec0d6..b33b946c0 100644
--- a/packages/connect/test/http_client_test.ts
+++ b/packages/connect/test/http_client_test.ts
@@ -122,6 +122,18 @@ describe('HttpClient', () => {
const fees = await relayerClient.getFeesAsync(request);
expect(fees).to.be.deep.equal(feesResponse);
});
+ it('does not mutate input', async () => {
+ fetchMock.post(url, feesResponseJSON);
+ const makerTokenAmountBefore = new BigNumber(request.makerTokenAmount);
+ const takerTokenAmountBefore = new BigNumber(request.takerTokenAmount);
+ const saltBefore = new BigNumber(request.salt);
+ const expirationUnixTimestampSecBefore = new BigNumber(request.expirationUnixTimestampSec);
+ await relayerClient.getFeesAsync(request);
+ expect(makerTokenAmountBefore).to.be.deep.equal(request.makerTokenAmount);
+ expect(takerTokenAmountBefore).to.be.deep.equal(request.takerTokenAmount);
+ expect(saltBefore).to.be.deep.equal(request.salt);
+ expect(expirationUnixTimestampSecBefore).to.be.deep.equal(request.expirationUnixTimestampSec);
+ });
it('throws an error for invalid JSON response', async () => {
fetchMock.post(url, { test: 'dummy' });
expect(relayerClient.getFeesAsync(request)).to.be.rejected();