1 | const ref = require('ssb-ref')
|
2 | const Server = require('scuttle-testbot')
|
3 |
|
4 | exports.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 |
|
15 | exports.follow = function (id) {
|
16 | return {
|
17 | type: 'contact', contact: id, following: true
|
18 | }
|
19 | }
|
20 | exports.unfollow = function (id) {
|
21 | return {
|
22 | type: 'contact', contact: id, following: false
|
23 | }
|
24 | }
|
25 | exports.block = function (id) {
|
26 | return {
|
27 | type: 'contact', contact: id, blocking: true
|
28 | }
|
29 | }
|
30 |
|
31 | exports.pub = function (address) {
|
32 | return {
|
33 | type: 'pub',
|
34 | address: ref.parseAddress(address)
|
35 | }
|
36 | }
|
37 |
|
38 | exports.file = function (hash) {
|
39 | return {
|
40 | type: 'file',
|
41 | file: hash
|
42 | }
|
43 | }
|