/
ArrayPort.coffee
37 lines (28 loc) · 1.07 KB
/
ArrayPort.coffee
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
noflo = require "noflo"
getBaseGraph = ->
graph = new noflo.Graph "ArrayPort"
graph.addNode "Display", "Output"
graph.addInitial "Foo", "Display", "in"
graph.addInitial "Bar", "Display", "in"
graph
exports["test ArrayPort type"] = (test) ->
graph = getBaseGraph()
network = noflo.createNetwork graph, false, ->
port = network.processes["Display"].component.inPorts["in"]
test.equal port instanceof noflo.ArrayPort, true
test.done()
exports["test connecting to ArrayPorts"] = (test) ->
graph = getBaseGraph()
network = noflo.createNetwork graph, false, ->
test.equal network.connections.length, 2
port = network.processes["Display"].component.inPorts["in"]
test.equal port.sockets.length, 2
test.done()
exports["test removing ArrayPorts"] = (test) ->
graph = getBaseGraph()
network = noflo.createNetwork graph, false, ->
port = network.processes["Display"].component.inPorts["in"]
first = port.sockets[0]
port.detach first
test.equal port.sockets.length, 1
test.done()