Permalink
Browse files

Integrate test with mocha and should

  • Loading branch information...
wdavidw committed Nov 12, 2012
1 parent 7e7ca86 commit b3386c8e5fdf6199d51a9f839e22440d3256f4a2
Showing with 68 additions and 15 deletions.
  1. +7 −1 package.json
  2. +39 −8 test/git.coffee
  3. +22 −6 test/release.coffee
View
@@ -8,7 +8,13 @@
],
"engines": { "node": ">= 0.1.90" },
"dependencies" : {
- "coffee-script" : "latest"
+ "coffee-script" : "latest",
+ "connect" : "latest"
+ },
+ "devDependencies" : {
+ "mocha" : "latest",
+ "should" : "latest",
+ "each" : "latest"
},
"keywords": ["connect", "express", "dojo"],
"repository": {
View
@@ -1,13 +1,31 @@
-dojo = require('connect-dojo');
+dojo = require '..'
+fs = require 'fs'
+each = require 'each'
+should = require 'should'
-module.exports =
- 'Test git # HEAD': (next) ->
- middleware = dojo { method: 'git' }
- req = { url: 'http://localhost' }
+describe 'Git', ->
+ it 'should download dojo HEAD', (next) ->
+ @timeout 0
+ middleware = dojo method: 'git'
+ req = url: 'http://localhost'
res = {}
- middleware req, res, next
- 'Test git # revision': (next) ->
+ middleware req, res, (err) ->
+ should.not.exist err
+ each([
+ '/tmp/git-dojo-HEAD'
+ '/tmp/git-dijit-HEAD'
+ '/tmp/git-dojox-HEAD'
+ '/tmp/git-util-HEAD'
+ ])
+ .on 'item', (next, path) ->
+ fs.stat path, (err, stats) ->
+ should.not.exist err
+ stats.isDirectory().should.be.ok
+ next()
+ .on 'both', next
+ it 'should download specified revisions', (next) ->
+ @timeout 0
middleware = dojo
method: 'git',
dojo_revision: '852b5161559f3eda16dc'
@@ -16,4 +34,17 @@ module.exports =
util_revision: 'f9cbb550e2959024df57'
req = { url: 'http://localhost' }
res = {}
- middleware req, res, next
+ middleware req, res, (err) ->
+ should.not.exist err
+ each([
+ '/tmp/git-dojo-852b5161559f3eda16dc'
+ '/tmp/git-dijit-37b5298bb8b4f24134d5'
+ '/tmp/git-dojox-145d3bec095382c2f4ac'
+ '/tmp/git-util-f9cbb550e2959024df57'
+ ])
+ .on 'item', (next, path) ->
+ fs.stat path, (err, stats) ->
+ should.not.exist err
+ stats.isDirectory().should.be.ok
+ next()
+ .on 'both', next
View
@@ -1,9 +1,25 @@
-dojo = require('connect-dojo');
+dojo = require '..'
+fs = require 'fs'
+should = require 'should'
+each = require 'each'
-module.exports =
- 'Test release # version': (next) ->
- middleware = dojo { version: '1.5.0' }
- req = { url: 'http://localhost' }
+describe 'Release', ->
+ it 'should download specific release', (next) ->
+ @timeout 0
+ middleware = dojo version: '1.5.0'
+ req = url: 'http://localhost'
res = {}
- middleware req, res, next
+ middleware req, res, (err) ->
+ should.not.exist err
+ each([
+ '/tmp/dojo-release-1.5.0/dojo'
+ '/tmp/dojo-release-1.5.0/dijit'
+ '/tmp/dojo-release-1.5.0/dojox'
+ ])
+ .on 'item', (next, path) ->
+ fs.stat path, (err, stats) ->
+ should.not.exist err
+ stats.isDirectory().should.be.ok
+ next()
+ .on 'both', next

0 comments on commit b3386c8

Please sign in to comment.