Permalink
Browse files

Use noflo-test instead

  • Loading branch information...
1 parent 4f73d5f commit 71c4ecb97ead2abba5e850a5a7422fae0e3810ac @kenhkan kenhkan committed Jul 30, 2013
View
@@ -4,4 +4,7 @@ node_js:
- 0.8
- 0.10
-script: npm test
+script: npm test
+
+before_script:
+ - npm install -g grunt-cli
View
@@ -73,6 +73,11 @@ module.exports = ->
coffeelint:
components: ['components/*.coffee']
+ # noflo-test
+ exec:
+ test:
+ command: './node_modules/.bin/noflo-test --spec test/*.coffee'
+
# Grunt plugins used for building
@loadNpmTasks 'grunt-contrib-coffee'
@loadNpmTasks 'grunt-component'
@@ -85,6 +90,7 @@ module.exports = ->
@loadNpmTasks 'grunt-cafe-mocha'
@loadNpmTasks 'grunt-mocha-phantomjs'
@loadNpmTasks 'grunt-coffeelint'
+ @loadNpmTasks 'grunt-exec'
# Our local tasks
@registerTask 'build', 'Build NoFlo for the chosen target platform', (target = 'all') =>
@@ -97,6 +103,7 @@ module.exports = ->
@registerTask 'test', 'Build NoFlo and run automated tests', (target = 'all') =>
@task.run 'coffeelint'
+ @task.run 'exec:test'
@task.run 'coffee'
if target is 'all' or target is 'nodejs'
@task.run 'cafemocha'
View
@@ -30,6 +30,8 @@
"owl-deepcopy": "0.0.2"
},
"devDependencies": {
+ "grunt-exec": "~0.4.2",
+ "noflo-test": "~0.0.4",
"coffeelint": "*",
"coffee-script": "1.4.x",
"grunt": "~0.4.1",
@@ -1,84 +0,0 @@
-noflo = require 'noflo'
-if typeof process is 'object' and process.title is 'node'
- chai = require 'chai' unless chai
- ObjectToPackets = require '../components/ObjectToPackets.coffee'
-else
- ObjectToPackets = require 'noflo-adapters/components/ObjectToPackets.js'
-
-describe 'ObjectToPackets component', ->
- c = null
- ins = null
- out = null
- depth = null
-
- beforeEach ->
- c = ObjectToPackets.getComponent()
- ins = noflo.internalSocket.createSocket()
- out = noflo.internalSocket.createSocket()
- depth = noflo.internalSocket.createSocket()
- c.inPorts.in.attach ins
- c.inPorts.depth.attach depth
- c.outPorts.out.attach out
-
- describe 'when instantiated', ->
- it 'should have an input port', ->
- chai.expect(c.inPorts.in).to.be.an 'object'
- chai.expect(c.inPorts.depth).to.be.an 'object'
- it 'should have an output port', ->
- chai.expect(c.outPorts.out).to.be.an 'object'
-
- describe 'given an object', ->
- input =
- a: 1
- b:
- c: 2
- d: [3, 4]
- e:
- f: [5, 6]
-
- it 'becomes grouped packets', (done) ->
- packets = ['a', 1, 'b', 'c', 2, 'd', 3, 4, 'e', 'f', 5, 6]
-
- out.on 'begingroup', (group) ->
- chai.expect(packets.shift()).to.equal group
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.equal data
- out.on 'disconnect', (data) ->
- chai.expect(packets.length).to.equal 0
- done()
-
- ins.connect()
- ins.send input
- ins.disconnect()
-
- it 'becomes grouped packets with a specified number of levels', (done) ->
- packets = ['a', 1, 'b', 'c', 2, 'd', 3, 4, 'e', { f: [5, 6] }]
-
- out.on 'begingroup', (group) ->
- chai.expect(packets.shift()).to.equal group
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.deep.equal data
- out.on 'disconnect', (data) ->
- chai.expect(packets.length).to.equal 0
- done()
-
- depth.send 2
- ins.connect()
- ins.send input
- ins.disconnect()
-
- describe 'given a plain array', ->
- input = [1, 2, 3]
-
- it 'works just as well', (done) ->
- packets = [1, 2, 3]
-
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.equal data
- out.on 'disconnect', (data) ->
- chai.expect(packets.length).to.equal 0
- done()
-
- ins.connect()
- ins.send input
- ins.disconnect()
View
@@ -1,68 +0,0 @@
-noflo = require 'noflo'
-if typeof process is 'object' and process.title is 'node'
- chai = require 'chai' unless chai
- ObjectToString = require '../components/ObjectToString.coffee'
-else
- ObjectToString = require 'noflo-adapters/components/ObjectToString.js'
-
-describe 'ObjectToString component', ->
- c = null
- ins = null
- out = null
- assoc = null
- delim = null
-
- beforeEach ->
- c = ObjectToString.getComponent()
- ins = noflo.internalSocket.createSocket()
- out = noflo.internalSocket.createSocket()
- assoc = noflo.internalSocket.createSocket()
- delim = noflo.internalSocket.createSocket()
- c.inPorts.in.attach ins
- c.inPorts.assoc.attach assoc
- c.inPorts.delim.attach delim
- c.outPorts.out.attach out
-
- describe 'when instantiated', ->
- it 'should have an input port', ->
- chai.expect(c.inPorts.in).to.be.an 'object'
- chai.expect(c.inPorts.assoc).to.be.an 'object'
- chai.expect(c.inPorts.delim).to.be.an 'object'
- it 'should have an output port', ->
- chai.expect(c.outPorts.out).to.be.an 'object'
-
- describe 'given an object', ->
- input =
- a: 1
- b:
- c: 2
- d: [3, 4]
-
- it 'becomes a string using the default associator and delimitor', (done) ->
- packets = ["a:1,b:#{JSON.stringify(input.b)}"]
-
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.equal data
- out.on 'disconnect', (data) ->
- chai.expect(packets.length).to.equal 0
- done()
-
- ins.connect()
- ins.send input
- ins.disconnect()
-
- it 'stringifies an object with
- configurable associator and delimiter', (done) ->
- packets = ["a=1|b=#{JSON.stringify(input.b)}"]
-
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.equal data
- out.on 'disconnect', (data) ->
- chai.expect(packets.length).to.equal 0
- done()
-
- assoc.send '='
- delim.send '|'
- ins.connect()
- ins.send input
- ins.disconnect()
View
@@ -1,80 +0,0 @@
-noflo = require 'noflo'
-if typeof process is 'object' and process.title is 'node'
- chai = require 'chai' unless chai
- PacketsToArray = require '../components/PacketsToArray.coffee'
-else
- PacketsToArray = require 'noflo-adapters/components/PacketsToArray.js'
-
-describe 'PacketsToArray component', ->
- c = null
- ins = null
- out = null
-
- beforeEach ->
- c = PacketsToArray.getComponent()
- ins = noflo.internalSocket.createSocket()
- out = noflo.internalSocket.createSocket()
- c.inPorts.in.attach ins
- c.outPorts.out.attach out
-
- describe 'when instantiated', ->
- it 'should have an input port', ->
- chai.expect(c.inPorts.in).to.be.an 'object'
- it 'should have an output port', ->
- chai.expect(c.outPorts.out).to.be.an 'object'
-
- describe 'convert packets to array', ->
- it 'turns some IPs into an array', (done) ->
- out.on 'data', (data) ->
- chai.expect(data).to.deep.equal [1, 2, 3]
- done()
-
- ins.connect()
- ins.send 1
- ins.send 2
- ins.send 3
- ins.disconnect()
-
- it 'turns just one IP into an array of one', (done) ->
- out.on 'data', (data) ->
- chai.expect(data).to.deep.equal [1]
- done()
-
- ins.connect()
- ins.send 1
- ins.disconnect()
-
- it 'converts within groups', (done) ->
- packets = ['a', [1], [2]]
-
- out.on 'begingroup', (group) ->
- chai.expect(packets.shift()).to.equal group
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.deep.equal data
- out.on 'disconnect', ->
- chai.expect(packets.length).to.equal 0
- done()
-
- ins.connect()
- ins.beginGroup 'a'
- ins.send 1
- ins.endGroup 'a'
- ins.send 2
- ins.disconnect()
-
- it 'converts within groups but without top-level data packets', (done) ->
- packets = ['a', [1]]
-
- out.on 'begingroup', (group) ->
- chai.expect(packets.shift()).to.equal group
- out.on 'data', (data) ->
- chai.expect(packets.shift()).to.deep.equal data
- out.on 'disconnect', ->
- chai.expect(packets.length).to.equal 0
- done()
-
- ins.connect()
- ins.beginGroup 'a'
- ins.send 1
- ins.endGroup 'a'
- ins.disconnect()
@@ -1,48 +0,0 @@
-noflo = require 'noflo'
-if typeof process is 'object' and process.title is 'node'
- chai = require 'chai' unless chai
- PacketsToObject = require '../components/PacketsToObject.coffee'
-else
- PacketsToObject = require 'noflo-adapters/components/PacketsToObject.js'
-
-describe 'PacketsToObject component', ->
- c = null
- ins = null
- out = null
-
- beforeEach ->
- c = PacketsToObject.getComponent()
- ins = noflo.internalSocket.createSocket()
- out = noflo.internalSocket.createSocket()
- c.inPorts.in.attach ins
- c.outPorts.out.attach out
-
- describe 'when instantiated', ->
- it 'should have an input port', ->
- chai.expect(c.inPorts.in).to.be.an 'object'
- it 'should have an output port', ->
- chai.expect(c.outPorts.out).to.be.an 'object'
-
- describe 'provided some grouped packets', ->
- it 'gets back the object representation', (done) ->
- expected = []
- expected.a = ['a']
- expected.a.b = ['ab1', 'ab2']
- expected.c = ['c']
-
- out.on 'data', (data) ->
- chai.expect(data).to.deep.equal expected
- done()
-
- ins.connect()
- ins.beginGroup 'a'
- ins.send 'a'
- ins.beginGroup 'b'
- ins.send 'ab1'
- ins.send 'ab2'
- ins.endGroup 'b'
- ins.endGroup 'a'
- ins.beginGroup 'c'
- ins.send 'c'
- ins.endGroup 'c'
- ins.disconnect()
Oops, something went wrong.

0 comments on commit 71c4ecb

Please sign in to comment.