-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.js
37 lines (30 loc) · 1.15 KB
/
archive.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
const context = require('ara-context')()
const test = require('ava')
const { archive } = require('../archive')
const { create } = require('../create')
test('archive() Invalid opts', async (t) => {
const identity = await create({ context, password: 'password' })
await t.throwsAsync(
archive(),
{ instanceOf: TypeError },
'Expecting identity to be an object.'
)
// TODO: Find a way to ignore $HOME/.ararc when runnnig locally
// await t.throwsAsync(archive(identity), TypeError, 'Expecting options to be an object.')
// await t.throwsAsync(archive(identity, {}), TypeError, 'Shared secret cannot be empty.')
await t.throwsAsync(
archive(identity, { secret: 1234 }),
{ instanceOf: TypeError },
'Expecting shared secret to be a string or buffer.'
)
await t.throwsAsync(
archive(identity, { secret: 'test-node', keyring: './fixtures/keyring.pub' }),
{ instanceOf: TypeError },
'Expecting network name for the archiver.'
)
await t.throwsAsync(
archive(identity, { secret: 'test-node', keyring: './fixtures/keyring.pub', network: 'archiver' }),
{ instanceOf: Error },
'Archiver request timed out.'
)
})