generated from izayl/template-typescript-npm-package
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
595 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { V2Client } from '../../src' | ||
import { Network } from '../../src/v2/models' | ||
import { config } from './config' | ||
|
||
describe('/v2/nft | Get Ethereum NFT balances for addresses.', () => { | ||
const client = new V2Client(config) | ||
let request = jest.fn() | ||
|
||
const resetMock = () => { | ||
request = jest.fn() | ||
client.sendRequest = request | ||
} | ||
|
||
describe('GET /v2/nft/balances/net-worth', () => { | ||
beforeEach(resetMock) | ||
|
||
it('should accept following parameters', () => { | ||
const parameters = { | ||
addresses: ['vitalik.eth'], | ||
} | ||
client.nft.getNetWorth(parameters) | ||
|
||
expect(request).toBeCalledTimes(1) | ||
expect(request.mock.calls[0]).toEqual([ | ||
{ | ||
method: 'GET', | ||
params: parameters, | ||
url: '/v2/nft/balances/net-worth', | ||
}, | ||
]) | ||
}) | ||
}) | ||
|
||
describe('GET /v2/nft/balances/collections', () => { | ||
beforeEach(resetMock) | ||
|
||
it('should accept following parameters', () => { | ||
const parameters = { | ||
addresses: ['vitalik.eth'], | ||
} | ||
|
||
client.nft.getCollections(parameters) | ||
|
||
expect(request).toBeCalledTimes(1) | ||
expect(request.mock.calls[0]).toEqual([ | ||
{ | ||
method: 'GET', | ||
params: parameters, | ||
url: '/v2/nft/balances/collections', | ||
}, | ||
]) | ||
}) | ||
}) | ||
|
||
describe('GET /v2/nft/balances/collections-totals', () => { | ||
beforeEach(resetMock) | ||
|
||
it('should accept following url/parameters', () => { | ||
const parameters = { | ||
addresses: ['vitalik.eth'], | ||
} | ||
client.nft.getCollectionsTotals(parameters) | ||
|
||
expect(request).toBeCalledTimes(1) | ||
expect(request.mock.calls[0]).toEqual([ | ||
{ | ||
method: 'GET', | ||
params: parameters, | ||
url: '/v2/nft/balances/collections-totals', | ||
}, | ||
]) | ||
}) | ||
}) | ||
|
||
describe('GET /v2/nft/balances/tokens', () => { | ||
beforeEach(resetMock) | ||
|
||
it('should accept following url/parameters', () => { | ||
const parameters = { | ||
addresses: ['vitalik.eth'], | ||
} | ||
client.nft.getTokens(parameters) | ||
|
||
expect(request).toBeCalledTimes(1) | ||
expect(request.mock.calls[0]).toEqual([ | ||
{ | ||
method: 'GET', | ||
params: parameters, | ||
url: '/v2/nft/balances/tokens', | ||
}, | ||
]) | ||
}) | ||
}) | ||
|
||
describe('GET /v2/nft/balances/tokens-totals', () => { | ||
beforeEach(resetMock) | ||
|
||
it('should accept following url/parameters', () => { | ||
const parameters = { | ||
addresses: ['vitalik.eth'], | ||
} | ||
client.nft.getTokensTotals(parameters) | ||
|
||
expect(request).toBeCalledTimes(1) | ||
expect(request.mock.calls[0]).toEqual([ | ||
{ | ||
method: 'GET', | ||
params: parameters, | ||
url: '/v2/nft/balances/tokens-totals', | ||
}, | ||
]) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.