Skip to content

Commit 0168039

Browse files
committed
Moves db.load() test to new framework
1 parent d848761 commit 0168039

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed
File renamed without changes.
File renamed without changes.

test/integration2/db.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,28 @@ describe("db.define()", function() {
2929
return done();
3030
});
3131
});
32+
33+
describe("db.load()", function () {
34+
var db = null;
35+
36+
before(function (done) {
37+
helper.connect(function (connection) {
38+
db = connection;
39+
40+
return done();
41+
});
42+
});
43+
44+
after(function () {
45+
return db.close();
46+
});
47+
48+
it("should require a file based on relative path", function (done) {
49+
db.load("../support/spec_load", function () {
50+
db.models.should.have.property("person");
51+
db.models.should.have.property("pet");
52+
53+
return done();
54+
});
55+
});
56+
});

test/support/spec_load.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = function (db, cb) {
2+
db.define("person", {
3+
name : String
4+
});
5+
6+
return db.load("./spec_load_second", cb);
7+
};

test/support/spec_load_second.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function (db, cb) {
2+
db.define("pet", {
3+
name : String
4+
});
5+
6+
setTimeout(function () {
7+
return cb();
8+
}, 200);
9+
};

0 commit comments

Comments
 (0)