UNPKG

795 BJavaScriptView Raw
1const ref = require('ssb-ref')
2const Server = require('scuttle-testbot')
3
4exports.Server = function Testbot (opts = {}) {
5 let stack = Server
6 .use(require('ssb-replicate'))
7 .use(require('..'))
8
9 if (opts.tribes === true)
10 stack = stack.use(require('ssb-tribes'))
11
12 return stack(opts)
13}
14
15exports.follow = function (id) {
16 return {
17 type: 'contact', contact: id, following: true
18 }
19}
20exports.unfollow = function (id) {
21 return {
22 type: 'contact', contact: id, following: false
23 }
24}
25exports.block = function (id) {
26 return {
27 type: 'contact', contact: id, blocking: true
28 }
29}
30
31exports.pub = function (address) {
32 return {
33 type: 'pub',
34 address: ref.parseAddress(address)
35 }
36}
37
38exports.file = function (hash) {
39 return {
40 type: 'file',
41 file: hash
42 }
43}