stream-client.js
853 Bytes
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';
var test = require('tape');
var sinon = require('sinon');
var tinyJsonRpc = require('../');
var Client = tinyJsonRpc.Client;
var StreamClient = tinyJsonRpc.StreamClient;
test('StreamClient instances', function (t) {
var mockStream = { on: function () {} };
t.test('are instances of Client', function (t) {
var client = new StreamClient({
server: mockStream
});
t.ok(client instanceof Client);
t.end();
});
t.test('provide a request method', function (t) {
var client = new StreamClient({
server: mockStream
});
t.ok(client.request instanceof Function);
t.end();
});
t.test('inherit a notify method', function (t) {
var client = new StreamClient({
server: mockStream
});
t.equal(client.notify, Client.prototype.notify);
t.end();
});
t.end();
});