Permalink
Browse files

migrated tests from testosterone to mocha

  • Loading branch information...
1 parent ab1ac41 commit ab8b3e8cf046ebd5efa39b6bbfe5b1238ef527dd @masylum committed May 8, 2012
Showing with 354 additions and 354 deletions.
  1. +6 −5 Makefile
  2. +2 −1 package.json
  3. +7 −8 test/helpers/mapper_test.js
  4. +15 −19 test/helpers/namespacer_test.js
  5. +230 −225 test/integration/integration_test.js
  6. +54 −55 test/model_test.js
  7. +40 −41 test/validator_test.js
View
@@ -1,24 +1,25 @@
NODE = node
+MOCHA = ./node_modules/.bin/mocha --reporter spec
test: test_model test_validator test_proxy test_update_document test_namespacer test_mapper test_integration
test_model:
- @$(NODE) test/model_test.js
+ @$(MOCHA) test/model_test
test_validator:
- @$(NODE) test/validator_test.js
+ @$(MOCHA) test/validator_test.js
test_update_document:
@$(NODE) test/helpers/update_document_test.js
test_namespacer:
- @$(NODE) test/helpers/namespacer_test.js
+ @$(MOCHA) test/helpers/namespacer_test.js
test_mapper:
- @$(NODE) test/helpers/mapper_test.js
+ @$(MOCHA) test/helpers/mapper_test.js
test_proxy:
@$(NODE) test/helpers/collection_proxy_test.js
test_integration:
- @$(NODE) test/integration/integration_test.js
+ @$(MOCHA) test/integration/integration_test.js
View
@@ -15,8 +15,9 @@
"underscore": "1.1.6"
},
"devDependencies": {
+ "mocha": "*",
"testosterone": "1.2.0",
- "gently": "0.9.1"
+ "gently": "git://github.com/masylum/node-gently.git"
},
"repository" : {"type": "git" , "url": "http://github.com/masylum/mongolia.git" },
"engines": { "node": ">= 0.4.0" }
@@ -1,9 +1,9 @@
-var testosterone = require('testosterone')({post: 3000, sync: true, title: 'mongolia/helpers/mapper_test.js'}),
- assert = testosterone.assert,
- Mapper = require('./../../lib/helpers/mapper');
+/*global describe, it*/
+var assert = require('assert')
+ , Mapper = require('./../../lib/helpers/mapper');
-testosterone
- .add('`mapDocument` should filter documents before being inserted or updated', function () {
+describe('mapper', function () {
+ it('`mapDocument` should filter documents before being inserted or updated', function () {
var test = Mapper.mapDocument
, arg
, toUpper = function (val) {
@@ -52,7 +52,6 @@ testosterone
assert.equal(typeof arg.list[0], typeof update.list[0]);
assert.equal(typeof arg.list[1], typeof update.list[1]);
assert.equal(typeof arg.list[2], typeof update.list[2]);
- })
-
- .run();
+ });
+});
@@ -1,12 +1,9 @@
-var testosterone = require('testosterone')({sync: true, title: 'mongolia/helpers/namespacer_test.js'}),
- assert = testosterone.assert,
- Namespacer = require('./../../lib/helpers/namespacer');
+/*globals describe, it*/
+var assert = require('assert')
+ , Namespacer = require('./../../lib/helpers/namespacer');
-testosterone
- .before(function () {
- })
-
- .add('`resolveNamespace` implements the whole namespace API', function () {
+describe('namespacer', function () {
+ it('`resolveNamespace` implements the whole namespace API', function () {
var test = Namespacer.resolveNamespace
, namespaces = { jazz: ['mile.davis', 'coltrane', 'ellington', 'fitzgerald']
, modern: { extend: 'jazz'
@@ -15,9 +12,9 @@ testosterone
assert.deepEqual(test(namespaces, 'jazz'), namespaces.jazz);
assert.deepEqual(test(namespaces, 'modern'), ['mile.davis', 'coltrane', 'cohen', 'corea']);
- })
+ });
- .add('`addFieldFindOne` adds `fields` to findOne method if using a namespace', function () {
+ it('`addFieldFindOne` adds `fields` to findOne method if using a namespace', function () {
var test = Namespacer.addFieldFindOne
, args
, cb = function () {}
@@ -36,9 +33,9 @@ testosterone
args = [{_id: 1}, {fields: {zemba: -1}}, cb];
test(visibility, args);
assert.deepEqual(args[1], fields);
- })
+ });
- .add('`addFieldFind` adds `fields` to find methods if using a namespace', function () {
+ it('`addFieldFind` adds `fields` to find methods if using a namespace', function () {
var test = Namespacer.addFieldFind
, args
, cb = function () {}
@@ -60,9 +57,9 @@ testosterone
args = [{_id: 1}, {zemba: -1}, {skip: 1}, cb];
test(visibility, args);
assert.deepEqual(args[1], fields);
- })
+ });
- .add('`addFieldFindAndModify` adds `fields` to findAndModify method if using a namespace', function () {
+ it('`addFieldFindAndModify` adds `fields` to findAndModify method if using a namespace', function () {
var test = Namespacer.addFieldFindAndModify
, args
, cb = function () {}
@@ -84,9 +81,9 @@ testosterone
args = [{_id: 1}, [], {foo: 'bar'}, {fields: {zemba: -1}}, cb];
test(visibility, args);
assert.deepEqual(args[3], fields);
- })
+ });
- .add('`filterUpdate` should filter documents before being inserted or updated', function () {
+ it('`filterUpdate` should filter documents before being inserted or updated', function () {
var test = Namespacer.filterUpdate
, arg
, insert = {django: {reinhardt: 'guitar', framework: null}, charlie: {parker: 'saxophone'}}
@@ -126,6 +123,5 @@ testosterone
arg = {'$set': {django: {reinhardt: 'guitar', framework: null}, will_not: 'be_update', charlie: { christian: 'guitar', parker: 'saxophone'}}};
test(visibility, arg);
assert.deepEqual(arg, {'$set': {django: {reinhardt: 'guitar', framework: null}, charlie: {parker: 'saxophone'}}});
- })
-
- .run();
+ });
+});
Oops, something went wrong.

0 comments on commit ab8b3e8

Please sign in to comment.