Permalink
Browse files

[test] use @dscape's specify instead of mocha

  • Loading branch information...
1 parent a73e535 commit 19487f76ec6cd1858c779e0c40d98aaf439bebee @3rd-Eden committed Jan 18, 2013
Showing with 46 additions and 55 deletions.
  1. +2 −6 package.json
  2. +44 −49 test/api.test.js
View
@@ -7,14 +7,10 @@
"test": "test"
},
"devDependencies": {
- "mocha": "~1.8.1",
- "chai": "~1.4.2"
+ "specify": "~1.1.1"
},
- "bundledDependencies": [
- "mocha"
- ],
"scripts": {
- "test": "./node_modules/.bin/mocha $(shell find test -name '*.test.js')"
+ "test": "node ./test/api.test.js"
},
"repository": "",
"keywords": [
View
@@ -1,60 +1,55 @@
-describe('zoidberg', function () {
- 'use strict';
+'use strict';
- /**
- * Assertations.
- */
- var chai = require('chai')
- , expect = chai.expect;
+var specify = require('specify');
- chai.Assertion.includeStack = true;
+/**
+ * (\/)(;,,;)(\/) whoopwhoopwhoop.
+ */
+var zoidberg = require('../zoidberg');
- /**
- * whoopwhoopwhoop.
- */
- var zoidberg = require('../zoidberg');
+/**
+ * Testing data
+ */
+var obj = { one: 1, two: 2, three: 3, four: 4 }
+ , arr = [1, 2, 3, 4];
- describe('#forEach', function () {
- var obj = { one: 1, two: 2, three: 3, four: 4 }
- , arr = [1, 2, 3, 4];
+specify('zoidberg#forEach accepts Arrays', function (assert) {
+ zoidberg.forEach(arr, function forEach(item, callback) {
+ assert.ok(typeof item === 'number');
+ assert.ok(typeof callback === 'function');
- it('accepts Arrays', function (done) {
- zoidberg.forEach(arr, function forEach(item, callback) {
- expect(item).to.be.a('number');
- expect(callback).to.be.a('function');
-
- callback();
- }, done);
- });
-
- it('captures sync thrown errors', function (done) {
- zoidberg.forEach(arr, function forEach(item, callback) {
- throw new Error('throw an error');
- }, function processed(err) {
- expect(err).to.be.a('error');
- expect(err.message).to.equal('throw an error');
+ callback();
+ }, function (err) {
+ assert.ok(!!err);
+ });
+});
- done();
- });
- });
+specify('zoidberg#forEach captures sync thrown errors', function (assert) {
+ zoidberg.forEach(arr, function forEach(item, callback) {
+ throw new Error('throw an error');
+ }, function processed(err) {
+ assert.ok(err instanceof Error);
+ assert.equal(err.message, 'throw an error');
+ });
+});
- it('captures async thrown errors', function (done) {
- zoidberg.forEach(arr, function forEach(item, callback) {
- process.nextTick(function () {
- throw new Error('throw an error');
- });
- }, function processed(err) {
- expect(err).to.be.a('error');
- expect(err.message).to.equal('throw an error');
-
- done();
- });
+specify('zoidberg#forEach captures async thrown errors', function (assert) {
+ zoidberg.forEach(arr, function forEach(item, callback) {
+ process.nextTick(function async() {
+ throw new Error('throw an error');
});
+ }, function processed(err) {
+ assert.ok(err instanceof Error);
+ assert.equal(err.message, 'throw an error');
+ });
+});
- it('accepts Objects', function (done) {
- zoidberg.forEach(obj, function forEach(key, callback) {
- callback();
- }, done);
- });
+specify('zoidberg#forEach accepts Objects', function (assert) {
+ zoidberg.forEach(obj, function forEach(key, callback) {
+ callback();
+ }, function (err) {
+ assert.ok(!!err);
});
});
+
+specify.run();

0 comments on commit 19487f7

Please sign in to comment.