forked from pkrumins/dnode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
null.js
34 lines (30 loc) · 859 Bytes
/
null.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
var dnode = require('../');
var test = require('tape');
test('null', function (t) {
t.plan(5);
var server = dnode({
empty : null,
timesTen : function (n, reply) {
t.equal(n, 50);
reply(n * 10);
},
moo : function (reply) { reply(100) },
sTimesTen : function (n, cb) {
t.equal(n, 5);
cb(n * 10, null);
},
});
var client = dnode();
client.on('remote', function (remote) {
remote.moo(function (x) {
t.equal(x, 100, 'remote moo == 100');
});
remote.sTimesTen(5, function (m) {
t.equal(m, 50, '5 * 10 == 50');
remote.timesTen(m, function (n) {
t.equal(n, 500, '50 * 10 == 500');
});
});
});
server.pipe(client).pipe(server);
});