Example of minimum vows test for node.js using coffeescript


exports.Car = ->
  this.color = 'red'


# Require vows stuff
vows = require('vows')
assert = require('assert')
coffee = require('coffee-script')
# Require the class we want to test
superMinimum= require('./superminimum')
# Instantiate the function we are testing
Car = superMinimum.Car
# This is a test with a title
vows.describe('Cars Application in Coffee').addBatch({
  # The next 2 lines set the "topic" of this test
  'A car':
    topic: new(Car),
    'is red': (car) ->
      assert.equal(car.color, 'red')
    'is not blue': (car) ->
      assert.notEqual(car.color, 'blue')
  # Here we could add a comma and another "topic"

Run “vows superminimum-test.coffee –spec” and you get this :)

  ♢ Cars Application in Coffee 
  A car
    ✓ is red
    ✓ is not blue
✓ OK » 2 honored (0.002s)

Post a comment.