Moved to mocha
This commit is contained in:
parent
f2b34378ae
commit
9f063c13c5
|
@ -0,0 +1,14 @@
|
|||
## TESTS
|
||||
|
||||
TESTER = ./node_modules/.bin/mocha
|
||||
OPTS = --require ./test/init.js
|
||||
TESTS = test/*.test.js
|
||||
|
||||
test:
|
||||
$(TESTER) $(OPTS) $(TESTS)
|
||||
test-verbose:
|
||||
$(TESTER) $(OPTS) --reporter spec $(TESTS)
|
||||
testing:
|
||||
$(TESTER) $(OPTS) --watch $(TESTS)
|
||||
|
||||
.PHONY: test docs
|
13
package.json
13
package.json
|
@ -12,7 +12,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"coffee-script": "latest",
|
||||
"nodeunit": "latest"
|
||||
"should": "~1.2.2",
|
||||
"mocha": "~1.8.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -20,8 +21,14 @@
|
|||
},
|
||||
"author": "Anatoliy Chakkaev <mail@anatoliy.in>",
|
||||
"maintainers": [
|
||||
{ "name": "dgsan", "url": "https://github.com/dgsan" },
|
||||
{ "name": "Anatoliy Chakkaev", "url": "https://github.com/1602" }
|
||||
{
|
||||
"name": "dgsan",
|
||||
"url": "https://github.com/dgsan"
|
||||
},
|
||||
{
|
||||
"name": "Anatoliy Chakkaev",
|
||||
"url": "https://github.com/1602"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
var Schema = require('jugglingdb').Schema;
|
||||
|
||||
global.getSchema = function() {
|
||||
var db = new Schema(require('../'), {
|
||||
database: 'myapp_test',
|
||||
username: 'root'
|
||||
});
|
||||
db.log = function (a) {
|
||||
console.log(a);
|
||||
};
|
||||
return db;
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
var jdb = require('jugglingdb'),
|
||||
Schema = jdb.Schema,
|
||||
test = jdb.test,
|
||||
schema = new Schema(__dirname + '/..', {
|
||||
database: 'myapp_test',
|
||||
username: 'root'
|
||||
});
|
||||
|
||||
test(module.exports, schema);
|
||||
|
||||
var Post, User;
|
||||
|
||||
test.it('hasMany should support additional conditions', function (test) {
|
||||
|
||||
Post = schema.models.Post;
|
||||
User = schema.models.User;
|
||||
|
||||
User.create(function (e, u) {
|
||||
u.posts.create({}, function (e, p) {
|
||||
u.posts({where: {id: p.id}}, function (e, posts) {
|
||||
test.equal(posts.length, 1, 'There should be only 1 post.');
|
||||
test.done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
var db, Model, should = require('should');
|
||||
|
||||
require('jugglingdb/test/common.batch.js');
|
||||
require('jugglingdb/test/include.test.js');
|
||||
|
||||
var Post, User;
|
||||
|
||||
// test.it('hasMany should support additional conditions', function (test) {
|
||||
//
|
||||
// Post = schema.models.Post;
|
||||
// User = schema.models.User;
|
||||
//
|
||||
// User.create(function (e, u) {
|
||||
// u.posts.create({}, function (e, p) {
|
||||
// u.posts({where: {id: p.id}}, function (e, posts) {
|
||||
// test.equal(posts.length, 1, 'There should be only 1 post.');
|
||||
// test.done();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// });
|
||||
|
Loading…
Reference in New Issue