-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.js
43 lines (37 loc) · 838 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
'use strict'
const t = require('tap')
const test = t.test
const rimraf = require('rimraf')
const Fastify = require('fastify')
const gunPlugin = require('./')
t.tearDown(() => {
rimraf('./test', err => {
if (err) throw err
})
})
test('gun namespace should exist', t => {
t.plan(3)
const fastify = Fastify()
fastify
.register(gunPlugin, { name: 'test' })
.ready(err => {
t.error(err)
t.ok(fastify.gun)
fastify.close(() => {
t.pass('unlock')
})
})
})
test('gun should support gundb operations', t => {
t.plan(2)
const fastify = Fastify()
fastify
.register(gunPlugin, { name: 'test' })
.ready(err => {
t.error(err)
fastify.gun.get('test').set('d').once(function (val) {
if (!val) t.error('no data')
t.equal('d', val)
})
})
})