This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.test.js
58 lines (45 loc) · 1.59 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const Luno = require('./index')
const options = {
key: process.env.LUNO_KEY,
secret: process.env.LUNO_SECRET
}
test('should be defined', () => {
expect(Luno).toBeDefined()
})
test('should return new Luno client instance', () => {
const client = new Luno(options)
expect(client.getTicker).toBeDefined()
expect(client.getBalances).toBeDefined()
})
test('should get latest ticker indicators', async () => {
const client = new Luno(options)
const ticker = await client.getTicker()
expect(typeof ticker).toBe('object')
expect(ticker.timestamp).toBeDefined()
})
test('should get latest ticker indicators from all active Luno exchanges', async () => {
const client = new Luno(options)
const tickers = await client.getAllTickers()
expect(typeof tickers).toBe('object')
expect(tickers.tickers).toBeDefined()
expect(Array.isArray(tickers.tickers)).toBe(true)
})
test('should get balances', async () => {
const client = new Luno(options)
const balances = await client.getBalances()
expect(typeof balances).toBe('object')
})
test('should get a list of bids and asks in the order book', async () => {
const client = new Luno(options)
const orderBook = await client.getOrderBook()
expect(typeof orderBook).toBe('object')
expect(orderBook.bids).toBeDefined()
expect(Array.isArray(orderBook.bids)).toBe(true)
})
test('should get a list of the most recent trades', async () => {
const client = new Luno(options)
const trades = await client.getTrades()
expect(typeof trades).toBe('object')
expect(trades.trades).toBeDefined()
expect(Array.isArray(trades.trades)).toBe(true)
})