-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from binance/rc-v3.3.0
Release v3.3.0
- Loading branch information
Showing
51 changed files
with
2,252 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getCollateralRecord', () => { | ||
it('should return collateral records', () => { | ||
nockMock('/sapi/v1/simple-earn/flexible/history/collateralRecord')(mockResponse) | ||
|
||
return SpotClient.getCollateralRecord().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
it('should return collateral records with params', () => { | ||
const parameters = { | ||
productId: '1' | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/history/collateralRecord?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getCollateralRecord(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
28 changes: 28 additions & 0 deletions
28
__tests__/spot/simple_earn/getFlexiblePersonalLeftQuota.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global describe, it, expect */ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup') | ||
|
||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
const productId = '1' | ||
|
||
describe('#getFlexiblePersonalLeftQuota', () => { | ||
describe('throw MissingParameterError', () => { | ||
it('missing productId', () => { | ||
expect(() => { | ||
SpotClient.getFlexiblePersonalLeftQuota('') | ||
}).toThrow(MissingParameterError) | ||
}) | ||
}) | ||
it('should return flexible personal left quota', () => { | ||
const parameters = { | ||
productId | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/personalLeftQuota?${buildQueryString({ ...parameters })}`)(mockResponse) | ||
|
||
return SpotClient.getFlexiblePersonalLeftQuota(productId).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getFlexibleProductList', () => { | ||
it('should return flexible product list', () => { | ||
nockMock('/sapi/v1/simple-earn/flexible/list')(mockResponse) | ||
|
||
return SpotClient.getFlexibleProductList().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return flexible product list with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/list?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleProductList(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
__tests__/spot/simple_earn/getFlexibleProductPosition.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getFlexibleProductPosition', () => { | ||
it('should return flexible product position', () => { | ||
nockMock('/sapi/v1/simple-earn/flexible/position')(mockResponse) | ||
|
||
return SpotClient.getFlexibleProductPosition().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return flexible product position with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
productId: '1', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/position?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleProductPosition(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
__tests__/spot/simple_earn/getFlexibleRedemptionRecord.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getFlexibleRedemptionRecord', () => { | ||
it('should return flexible redemption records', () => { | ||
nockMock('/sapi/v1/simple-earn/flexible/history/redemptionRecord')(mockResponse) | ||
|
||
return SpotClient.getFlexibleRedemptionRecord().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return flexible redemption records with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
productId: '1', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/history/redemptionRecord?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleRedemptionRecord(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
30 changes: 30 additions & 0 deletions
30
__tests__/spot/simple_earn/getFlexibleRewardsRecord.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* global describe, it, expect */ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
const type = 'REALTIME' | ||
|
||
describe('#getFlexibleRewardsRecord', () => { | ||
describe('throw MissingParameterError', () => { | ||
it('missing productId', () => { | ||
expect(() => { | ||
SpotClient.getFlexibleRewardsRecord('') | ||
}).toThrow(MissingParameterError) | ||
}) | ||
}) | ||
|
||
it('should return flexible reward records', () => { | ||
const parameters = { | ||
type, | ||
productId: '1', | ||
asset: 'USDT' | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/history/rewardsRecord?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleRewardsRecord(type, parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
__tests__/spot/simple_earn/getFlexibleSubscriptionPreview.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* global describe, it, expect */ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
const productId = '1' | ||
const amount = 10 | ||
|
||
describe('#getFlexibleSubscriptionPreview', () => { | ||
describe('throw MissingParameterError', () => { | ||
it('missing productId', () => { | ||
expect(() => { | ||
SpotClient.getFlexibleSubscriptionPreview('', amount) | ||
}).toThrow(MissingParameterError) | ||
}) | ||
|
||
it('missing amount', () => { | ||
expect(() => { | ||
SpotClient.getFlexibleSubscriptionPreview(productId, '') | ||
}).toThrow(MissingParameterError) | ||
}) | ||
}) | ||
it('should return flexible subscription previews', () => { | ||
const parameters = { | ||
productId, | ||
amount | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/subscriptionPreview?${buildQueryString({ ...parameters })}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleSubscriptionPreview(productId, amount).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
__tests__/spot/simple_earn/getFlexibleSubscriptionRecord.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getFlexibleSubscriptionRecord', () => { | ||
it('should return flexible subscription records', () => { | ||
nockMock('/sapi/v1/simple-earn/flexible/history/subscriptionRecord')(mockResponse) | ||
|
||
return SpotClient.getFlexibleSubscriptionRecord().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return flexible subscription records with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
purchaseId: '1', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/flexible/history/subscriptionRecord?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getFlexibleSubscriptionRecord(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
27 changes: 27 additions & 0 deletions
27
__tests__/spot/simple_earn/getLockedPersonalLeftQuota.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* global describe, it, expect */ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
const projectId = '1' | ||
|
||
describe('#getLockedPersonalLeftQuota', () => { | ||
describe('throw MissingParameterError', () => { | ||
it('missing projectId', () => { | ||
expect(() => { | ||
SpotClient.getLockedPersonalLeftQuota('') | ||
}).toThrow(MissingParameterError) | ||
}) | ||
}) | ||
it('should return locked personal left quota', () => { | ||
const parameters = { | ||
projectId | ||
} | ||
nockMock(`/sapi/v1/simple-earn/locked/personalLeftQuota?${buildQueryString({ ...parameters })}`)(mockResponse) | ||
|
||
return SpotClient.getLockedPersonalLeftQuota(projectId).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getLockedProductList', () => { | ||
it('should return locked product list', () => { | ||
nockMock('/sapi/v1/simple-earn/locked/list')(mockResponse) | ||
|
||
return SpotClient.getLockedProductList().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return locked product list with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/locked/list?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getLockedProductList(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
__tests__/spot/simple_earn/getLockedProductPosition.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getLockedProductPosition', () => { | ||
it('should return locked product position', () => { | ||
nockMock('/sapi/v1/simple-earn/locked/position')(mockResponse) | ||
|
||
return SpotClient.getLockedProductPosition().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return locked product position with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
positionId: '1', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/locked/position?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getLockedProductPosition(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
__tests__/spot/simple_earn/getLockedRedemptionRecord.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* global describe, it, expect */ | ||
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getLockedRedemptionRecord', () => { | ||
it('should return locked redemption records', () => { | ||
nockMock('/sapi/v1/simple-earn/locked/history/redemptionRecord')(mockResponse) | ||
|
||
return SpotClient.getLockedRedemptionRecord().then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
|
||
it('should return locked redemption records with params', () => { | ||
const parameters = { | ||
asset: 'USDT', | ||
positionId: '1', | ||
current: 5, | ||
size: 10 | ||
} | ||
nockMock(`/sapi/v1/simple-earn/locked/history/redemptionRecord?${buildQueryString(parameters)}`)(mockResponse) | ||
|
||
return SpotClient.getLockedRedemptionRecord(parameters).then(response => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.