Permalink
Browse files

first stab at CI friendly unit tests

  • Loading branch information...
1 parent 2be3f99 commit 6f4174bfa3cca6432da9907b9388c6640e7e26c9 @makeusabrew committed Nov 22, 2011
Showing with 35 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +19 −0 build.xml
  3. +1 −0 tests/reports/.gitignore
  4. +14 −0 tests/server/spec/StreamConsumerSpec.js
View
@@ -1,2 +1,3 @@
*.swo
*.swp
+tests/reports/*.xml
View
@@ -0,0 +1,19 @@
+<?xml version="1.0" ?>
+<project name="Nodeflakes" default="test">
+
+ <property name="project.dir" value="." />
+
+ <target name='clean'>
+ <echo msg='Cleaning up' />
+ <delete>
+ <fileset dir="tests/reports">
+ <include name="*.xml" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="test" description="Unit Tests" depends="clean">
+ <echo msg="Running Test Suite" />
+ <exec dir="tests" checkreturn="true" passthru="true" command="jasmine-node server/spec --junitreport" />
+ </target>
+</project>
@@ -0,0 +1 @@
+!.gitignore
@@ -0,0 +1,14 @@
+var srcDir = __dirname+'/../../..';
+
+var StreamConsumer = require(srcDir+'/app/workers/stream_consumer');
+
+describe('StreamConsumer', function() {
+ it('should emit an onLine message when receiving a carriage return', function() {
+ var consumer = new StreamConsumer();
+ consumer.onLine = function() {
+ asyncSpecDone();
+ }
+
+ consumer.processChunk('foobar\r');
+ });
+});

0 comments on commit 6f4174b

Please sign in to comment.