loopback/test/app.test.js

21 lines
656 B
JavaScript
Raw Normal View History

2013-06-07 19:57:51 +00:00
describe('app', function() {
2013-06-06 00:11:21 +00:00
2013-06-07 19:57:51 +00:00
describe('app.model(Model)', function() {
2013-07-16 20:46:33 +00:00
it("Expose a `Model` to remote clients", function() {
2013-07-16 17:49:25 +00:00
var memory = loopback.createDataSource({connector: loopback.Memory});
2013-06-11 16:01:44 +00:00
var Color = memory.createModel('color', {name: String});
2013-06-07 19:57:51 +00:00
app.model(Color);
2013-06-11 16:01:44 +00:00
assert.equal(app.models().length, 1);
2013-06-07 19:57:51 +00:00
});
2013-06-06 00:11:21 +00:00
});
2013-06-07 19:57:51 +00:00
describe('app.models()', function() {
2013-07-16 20:46:33 +00:00
it("Get the app's exposed models", function() {
2013-07-16 17:49:25 +00:00
var Color = loopback.createModel('color', {name: String});
2013-06-07 19:57:51 +00:00
var models = app.models();
2013-06-11 16:01:44 +00:00
assert.equal(models.length, 1);
assert.equal(models[0].modelName, 'color');
2013-06-06 00:11:21 +00:00
});
});
});