loopback/test/app.test.js

21 lines
658 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-06-11 16:01:44 +00:00
it("Expose a `Model` to remote clients.", function() {
var memory = asteroid.createDataSource({connector: asteroid.Memory});
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-06-11 16:01:44 +00:00
it("Get the app's exposed models.", function() {
var Color = asteroid.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
});
});
});