Permalink
Browse files

Switch tests to coffeescript

  • Loading branch information...
1 parent 568158a commit 39276c9ee1857dd9a201cc92a7698a808ca960ad @dignifiedquire dignifiedquire committed Mar 13, 2013
Showing with 47 additions and 1 deletion.
  1. +1 −1 gruntfile.coffee
  2. +46 −0 test/reporter.coffee
View
@@ -10,7 +10,7 @@ module.exports = (grunt) ->
reporter: 'dot'
unit:
src: [
- 'test/*.js'
+ 'test/*.coffee'
]
View
@@ -0,0 +1,46 @@
+chai = require 'chai'
+should = chai.should()
+sinon = require 'sinon'
+sinonaChai = require 'sinon-chai'
+
+chai.use(sinonaChai)
+
+TeamCityReporter = require('./../index')['reporter:teamcity'][1]
+
+describe 'TeamCity reporter', ->
+ reporter = null
+ mosaic = {id: 'id', name: 'Mosaic'}
+
+ beforeEach (done) ->
+ reporter = new TeamCityReporter (instance) ->
+ instance.write = sinon.spy()
+ done()
+
+ it 'should not produce messages without browsers', (done) ->
+ reporter.onRunStart []
+ reporter.onRunComplete []
+ reporter.write.should.not.been.called
+ done()
+
+ it 'should produce messages without tests', (done) ->
+ reporter.onRunStart [mosaic]
+ reporter.onRunComplete []
+ reporter.write.should.have.been.calledWith '##teamcity[browserStart name=\'Mosaic\']\n'
+ reporter.write.should.have.been.calledWith '##teamcity[browserEnd name=\'Mosaic\']\n'
+ done()
+
+ it 'should produce messages with one test', (done) ->
+ reporter.onRunStart [mosaic]
+ reporter.specSuccess mosaic, {description: 'SampleTest', time: 2, suite: ['Suite 1']}
+ reporter.onRunComplete []
+ reporter.write.should.have.been.calledWith('##teamcity[browserStart name=\'Mosaic\']\n')
+ reporter.write.should.have.been.calledWith('##teamcity[browserEnd name=\'Mosaic\']\n')
+ reporter.write.should.have.been.calledWith """
+ ##teamcity[testSuiteStarted name=\'Suite 1\']
+ ##teamcity[testStarted name=\'SampleTest\']
+ ##teamcity[testFinished name=\'SampleTest\' duration=\'2\']
+ ##teamcity[testSuiteFinished name=\'Suite 1\']
+
+ """
+ done()
+

0 comments on commit 39276c9

Please sign in to comment.