Permalink
Browse files

add initial vows

  • Loading branch information...
1 parent 9937e71 commit 9aeb2e3e42fb094ce666b8f8dbc730efc88305f0 @heupel committed Dec 23, 2011
Showing with 59 additions and 0 deletions.
  1. +59 −0 test/pingdom-test.coffee
View
@@ -0,0 +1,59 @@
+assert = require 'assert'
+vows = require 'vows'
+pc = require '../lib/pingdom'
+
+vows
+ .describe('Pingdom constructor')
+ .addBatch
+ 'when version is not passed in':
+ topic: -> pc.createClient('apiKey', 'username', 'password'),
+
+ "the version defaults to '2.0'": (topic) ->
+ assert.equal topic.version, '2.0'
+
+ "the apiKey is still set": (topic) ->
+ assert.equal topic.apiKey, 'apiKey'
+
+ "the username is still set": (topic) ->
+ assert.equal topic.username, 'username'
+
+ "the password is still set": (topic) ->
+ assert.equal topic.password, 'password'
+
+
+ .addBatch
+ 'when version is passed in':
+
+ 'and the version is null':
+ topic: -> pc.createClient('apiKey', 'username', 'password', null),
+
+ "the version is set to '2.0'": (topic) ->
+ assert.equal topic.version, '2.0'
+
+ "the apiKey is still set": (topic) ->
+ assert.equal topic.apiKey, 'apiKey'
+
+ "the username is still set": (topic) ->
+ assert.equal topic.username, 'username'
+
+ "the password is still set": (topic) ->
+ assert.equal topic.password, 'password'
+
+
+ 'and the version is not null':
+ topic: -> pc.createClient('apiKey', 'username', 'password', 'other-version'),
+
+ "the version is set to what's passed in": (topic) ->
+ assert.equal topic.version, 'other-version'
+
+ "the apiKey is still set": (topic) ->
+ assert.equal topic.apiKey, 'apiKey'
+
+ "the username is still set": (topic) ->
+ assert.equal topic.username, 'username'
+
+ "the password is still set": (topic) ->
+ assert.equal topic.password, 'password'
+
+
+ .export module

0 comments on commit 9aeb2e3

Please sign in to comment.