-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.js
34 lines (26 loc) · 968 Bytes
/
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
import test from 'ava';
import MillisatParser from './millisat-parser.js';
test('parseInput - valid number input', t => {
t.is(MillisatParser.parseInput(100000), 100000);
});
test('parseInput - valid string input', t => {
t.is(MillisatParser.parseInput("100000"), 100000);
});
test('parseInput - valid string input with msat suffix', t => {
t.is(MillisatParser.parseInput("100000msat"), 100000);
});
test('parseInput - convert to sats', t => {
t.is(MillisatParser.parseInput(100000, true), 100);
});
test('parseInput - convert to sats from string input', t => {
t.is(MillisatParser.parseInput("100000", true), 100);
});
test('parseInput - convert to sats from string input with msat suffix', t => {
t.is(MillisatParser.parseInput("100000msat", true), 100);
});
test('parseInput - invalid input format', t => {
const error = t.throws(() => {
MillisatParser.parseInput("invalid_input");
});
t.is(error.message, 'Invalid input format');
});