Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (26 sloc) 0.723 kB
9ea32f1 @bergie Component for reading packet groups
bergie authored
1 readenv = require "../src/components/ReadGroup"
2 socket = require "../src/lib/InternalSocket"
3
4 setupComponent = ->
5 c = readenv.getComponent()
6 ins = socket.createSocket()
7 out = socket.createSocket()
8 c.inPorts.in.attach ins
9 c.outPorts.out.attach out
10 [c, ins, out]
11
12 exports['test reading a group'] = (test) ->
13 test.expect 1
14 [c, ins, out] = setupComponent()
15 out.once 'data', (data) ->
16 test.equal data, 'foo'
17 test.done()
18 ins.beginGroup 'foo'
19 ins.send 'hello'
20
21 exports['test reading a subgroup'] = (test) ->
22 test.expect 1
23 [c, ins, out] = setupComponent()
24 out.once 'data', (data) ->
25 test.equal data, 'foo:bar'
26 test.done()
27 ins.beginGroup 'foo'
28 ins.beginGroup 'bar'
29 ins.send 'hello'
Something went wrong with that request. Please try again.