forked from lukeburns/hip2-dane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
44 lines (38 loc) · 929 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
35
36
37
38
39
40
41
42
43
44
const { test } = require('brittle')
const { fetchAddress, setServers } = require('.')
setServers([
'127.0.0.1'
])
test('fetch address', async assert => {
const expected = `hs1qshuyulxra3pqpwr40303t8pn79232zztuk4qgz`
const actual = await fetchAddress('iamfernando')
assert.is(expected, actual)
})
test('alias-address collision', async assert => {
try {
await fetchAddress('hs1qshuyulxra3pqpwr40303t8pn79232zztuk4qgz')
} catch (e) {
assert.pass(e.toString())
}
})
test('invalid address', async assert => {
try {
await fetchAddress('invalid-addr.bb-8')
} catch (e) {
assert.pass(e.toString())
}
})
test('invalid type', async assert => {
try {
await fetchAddress('invalid-type.bb-8')
} catch (e) {
assert.pass(e.toString())
}
})
test('response too large', async assert => {
try {
await fetchAddress('large-size.bb-8')
} catch (e) {
assert.pass(e.toString())
}
})