git ssb

1+

dinoworm ๐Ÿ› / vas



Tree: 7e467f6efa8f6320f4c92bbfbe6e905689e0b8eb

Files: 7e467f6efa8f6320f4c92bbfbe6e905689e0b8eb / test / basic.js

859 bytesRaw
1var test = require('tape')
2
3var vas = require('../')
4var pull = vas.pull
5
6test('can create a client and server streams', function (t) {
7 var expected = ['Timmy', 'Bob']
8 var service = {
9 name: 'people',
10 version: '0.0.0',
11 permissions: function (path, args) {},
12 manifest: {
13 find: 'source'
14 },
15 methods: function (server, config) {
16 return { find }
17
18 function find () {
19 return pull.values(expected)
20 }
21 }
22 }
23
24 var client = vas.createClient(service, {})
25 var server = vas.createServer(service, {})
26
27 var clientStream = client.createStream()
28 var serverStream = server.createStream()
29
30 pull(
31 clientStream,
32 serverStream,
33 clientStream
34 )
35
36 pull(
37 client.people.find(),
38 pull.collect(function (err, arr) {
39 t.error(err)
40 t.deepEqual(arr, expected)
41 t.end()
42 })
43 )
44})
45

Built with git-ssb-web