This repository has been archived by the owner on Nov 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
75 lines (65 loc) · 1.76 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const nemPayments = require('./index');
jest.setTimeout(60000);
test('fetches a \'hello world!\' live NEM transaction', async () => {
expect(
await nemPayments(
'NAER66-DXCNYE-BNMTWA-PKG7CU-27CMUP-TQQDSM-2KL6',
'Hello World!',
'http://173.212.238.176'
)
).toMatchObject({
transactions: expect.any(Array),
xemPaid: 0.1,
nemNode: 'http://173.212.238.176'
});
});
test('uses a default, unspecified NIS node', async () => {
expect(
await nemPayments(
'NAER66-DXCNYE-BNMTWA-PKG7CU-27CMUP-TQQDSM-2KL6',
'Hello World!'
)
).toMatchObject({
transactions: expect.any(Array),
xemPaid: 0.1,
nemNode: expect.any(String)
});
});
test('returns error message due to no input address', async () => {
expect(nemPayments()).rejects.toEqual(
'Please include a NEM address/account you wish to fetch transactions for.'
);
});
test('searches for transactions with empty messages, using custom node, limit results', async () => {
const options = {
node: 'http://199.217.118.114',
searchLimit: 250,
maxResults: 10
};
const payments = await nemPayments(
'NC64UF-OWRO6A-VMWFV2-BFX2NT-6W2GUR-K2EOX6-FFMZ',
'',
options
);
expect(payments).toMatchObject({
transactions: expect.any(Array),
xemPaid: expect.any(Number),
nemNode: expect.any(String)
});
});
test('return an unfiltered list of transactions', async () => {
const options = {
searchLimit: 200
};
const payments = await nemPayments(
'NC64UF-OWRO6A-VMWFV2-BFX2NT-6W2GUR-K2EOX6-FFMZ',
null,
options
);
expect(payments.transactions).toHaveLength(200);
expect(payments).toMatchObject({
transactions: expect.any(Array),
xemPaid: expect.any(Number),
nemNode: expect.any(String)
});
});