2020-01-21 19:19:18 +00:00
|
|
|
// Copyright IBM Corp. 2014,2019. All Rights Reserved.
|
2016-05-03 22:50:21 +00:00
|
|
|
// Node module: loopback
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
'use strict';
|
2019-10-07 09:45:34 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
const expect = require('./helpers/expect');
|
|
|
|
const loopback = require('../');
|
|
|
|
const path = require('path');
|
|
|
|
const request = require('supertest');
|
2015-09-19 02:13:30 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
describe('loopback.rest', function() {
|
2016-07-29 18:41:43 +00:00
|
|
|
this.timeout(10000);
|
2019-10-07 09:45:34 +00:00
|
|
|
let app, MyModel;
|
2016-05-02 12:53:21 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
beforeEach(function() {
|
2016-05-02 12:53:21 +00:00
|
|
|
// override the global app object provided by test/support.js
|
|
|
|
// and create a local one that does not share state with other tests
|
2016-11-15 21:46:23 +00:00
|
|
|
app = loopback({localRegistry: true, loadBuiltinModels: true});
|
|
|
|
app.set('remoting', {errorHandler: {debug: true, log: false}});
|
2019-10-07 09:45:34 +00:00
|
|
|
const db = app.dataSource('db', {connector: 'memory'});
|
2016-05-02 12:53:21 +00:00
|
|
|
MyModel = app.registry.createModel('MyModel');
|
|
|
|
MyModel.attachTo(db);
|
2014-02-04 15:17:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('works out-of-the-box', function(done) {
|
2014-07-31 04:57:45 +00:00
|
|
|
app.model(MyModel);
|
2014-02-04 15:17:32 +00:00
|
|
|
app.use(loopback.rest());
|
|
|
|
request(app).get('/mymodels')
|
|
|
|
.expect(200)
|
|
|
|
.end(done);
|
|
|
|
});
|
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
it('should report 200 for DELETE /:id found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
2016-11-15 21:46:23 +00:00
|
|
|
MyModel.create({name: 'm1'}, function(err, inst) {
|
2015-09-19 02:13:30 +00:00
|
|
|
request(app)
|
|
|
|
.del('/mymodels/' + inst.id)
|
|
|
|
.expect(200, function(err, res) {
|
|
|
|
expect(res.body.count).to.equal(1);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-07-31 04:57:45 +00:00
|
|
|
it('should report 404 for GET /:id not found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
request(app).get('/mymodels/1')
|
|
|
|
.expect(404)
|
2014-12-18 20:26:27 +00:00
|
|
|
.end(function(err, res) {
|
2016-05-05 04:09:06 +00:00
|
|
|
if (err) return done(err);
|
|
|
|
|
2019-10-07 09:45:34 +00:00
|
|
|
const errorResponse = res.body.error;
|
2014-12-18 20:26:27 +00:00
|
|
|
assert(errorResponse);
|
|
|
|
assert.equal(errorResponse.code, 'MODEL_NOT_FOUND');
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-12-18 20:26:27 +00:00
|
|
|
done();
|
|
|
|
});
|
2014-07-31 04:57:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should report 404 for HEAD /:id not found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
request(app).head('/mymodels/1')
|
|
|
|
.expect(404)
|
|
|
|
.end(done);
|
|
|
|
});
|
|
|
|
|
2014-10-22 21:39:39 +00:00
|
|
|
it('should report 200 for GET /:id/exists not found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
request(app).get('/mymodels/1/exists')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err, res) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
expect(res.body).to.eql({exists: false});
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-10-22 21:39:39 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-07-31 04:57:45 +00:00
|
|
|
it('should report 200 for GET /:id found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
2016-11-15 21:46:23 +00:00
|
|
|
MyModel.create({name: 'm1'}, function(err, inst) {
|
2014-07-31 04:57:45 +00:00
|
|
|
request(app).get('/mymodels/' + inst.id)
|
|
|
|
.expect(200)
|
|
|
|
.end(done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should report 200 for HEAD /:id found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
2016-11-15 21:46:23 +00:00
|
|
|
MyModel.create({name: 'm2'}, function(err, inst) {
|
2014-07-31 04:57:45 +00:00
|
|
|
request(app).head('/mymodels/' + inst.id)
|
|
|
|
.expect(200)
|
|
|
|
.end(done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-10-22 21:39:39 +00:00
|
|
|
it('should report 200 for GET /:id/exists found', function(done) {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
2016-11-15 21:46:23 +00:00
|
|
|
MyModel.create({name: 'm2'}, function(err, inst) {
|
2014-10-22 21:39:39 +00:00
|
|
|
request(app).get('/mymodels/' + inst.id + '/exists')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err, res) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
expect(res.body).to.eql({exists: true});
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-10-22 21:39:39 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-10-31 09:36:59 +00:00
|
|
|
it('should honour `remoting.rest.supportedTypes`', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = loopback({localRegistry: true});
|
2014-10-31 09:36:59 +00:00
|
|
|
|
|
|
|
// NOTE it is crucial to set `remoting` before creating any models
|
2019-10-07 09:45:34 +00:00
|
|
|
const supportedTypes = ['json', 'application/javascript', 'text/javascript'];
|
2016-11-15 21:46:23 +00:00
|
|
|
app.set('remoting', {rest: {supportedTypes: supportedTypes}});
|
2014-10-31 09:36:59 +00:00
|
|
|
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
request(app).get('/mymodels')
|
2014-11-21 02:35:36 +00:00
|
|
|
.set('Accept', 'text/html,application/xml;q= 0.9,*/*;q= 0.8')
|
2014-10-31 09:36:59 +00:00
|
|
|
.expect('Content-Type', 'application/json; charset=utf-8')
|
|
|
|
.expect(200, done);
|
|
|
|
});
|
|
|
|
|
2015-01-22 07:02:43 +00:00
|
|
|
it('allows models to provide a custom HTTP path', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const CustomModel = app.registry.createModel('CustomModel',
|
2016-11-15 21:46:23 +00:00
|
|
|
{name: String},
|
2016-12-06 14:40:42 +00:00
|
|
|
{http: {'path': 'domain1/CustomModelPath'}});
|
2015-01-22 07:02:43 +00:00
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
app.model(CustomModel, {dataSource: 'db'});
|
2015-01-22 07:02:43 +00:00
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
request(app).get('/domain1/CustomModelPath').expect(200).end(done);
|
|
|
|
});
|
|
|
|
|
2015-01-23 13:04:13 +00:00
|
|
|
it('should report 200 for url-encoded HTTP path', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const CustomModel = app.registry.createModel('CustomModel',
|
2016-11-15 21:46:23 +00:00
|
|
|
{name: String},
|
2016-12-06 14:40:42 +00:00
|
|
|
{http: {path: 'domain%20one/CustomModelPath'}});
|
2015-01-23 13:04:13 +00:00
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
app.model(CustomModel, {dataSource: 'db'});
|
2015-01-23 13:04:13 +00:00
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
request(app).get('/domain%20one/CustomModelPath').expect(200).end(done);
|
|
|
|
});
|
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
it('includes loopback.token when necessary', function(done) {
|
|
|
|
givenUserModelWithAuth();
|
2016-11-15 21:46:23 +00:00
|
|
|
app.enableAuth({dataSource: 'db'});
|
2014-02-04 15:17:32 +00:00
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
givenLoggedInUser(function(err, token) {
|
|
|
|
if (err) return done(err);
|
2016-05-02 12:53:21 +00:00
|
|
|
expect(token).instanceOf(app.models.AccessToken);
|
2014-02-04 15:17:32 +00:00
|
|
|
request(app).get('/users/' + token.userId)
|
|
|
|
.set('Authorization', token.id)
|
|
|
|
.expect(200)
|
|
|
|
.end(done);
|
2014-11-21 01:52:11 +00:00
|
|
|
}, done);
|
2014-02-04 15:17:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('does not include loopback.token when auth not enabled', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const User = givenUserModelWithAuth();
|
2014-02-04 15:17:32 +00:00
|
|
|
User.getToken = function(req, cb) {
|
|
|
|
cb(null, req.accessToken ? req.accessToken.id : null);
|
|
|
|
};
|
|
|
|
loopback.remoteMethod(User.getToken, {
|
2016-11-15 21:46:23 +00:00
|
|
|
accepts: [{type: 'object', http: {source: 'req'}}],
|
|
|
|
returns: [{type: 'object', name: 'id'}],
|
2014-02-04 15:17:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
app.use(loopback.rest());
|
|
|
|
givenLoggedInUser(function(err, token) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
request(app).get('/users/getToken')
|
|
|
|
.set('Authorization', token.id)
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err, res) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
expect(res.body.id).to.equal(null);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
done();
|
|
|
|
});
|
2014-11-21 01:52:11 +00:00
|
|
|
}, done);
|
2014-02-04 15:17:32 +00:00
|
|
|
});
|
|
|
|
|
2018-09-24 21:34:50 +00:00
|
|
|
it('rebuilds REST endpoints after a model was added', () => {
|
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
return request(app).get('/mymodels').expect(404).then(() => {
|
|
|
|
app.model(MyModel);
|
|
|
|
|
|
|
|
return request(app).get('/mymodels').expect(200);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-04-16 12:07:30 +00:00
|
|
|
it('rebuilds REST endpoints after a model was deleted', () => {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
return request(app).get('/mymodels').expect(200)
|
|
|
|
.then(() => {
|
|
|
|
app.deleteModelByName('MyModel');
|
|
|
|
|
|
|
|
return request(app).get('/mymodels').expect(404);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-09-24 21:34:50 +00:00
|
|
|
it('rebuilds REST endpoints after a remoteMethod was added', () => {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
|
|
|
|
return request(app).get('/mymodels/customMethod').expect(404)
|
|
|
|
.then(() => {
|
|
|
|
MyModel.customMethod = function(req, cb) {
|
|
|
|
cb(null, true);
|
|
|
|
};
|
|
|
|
MyModel.remoteMethod('customMethod', {
|
|
|
|
http: {verb: 'get'},
|
|
|
|
accepts: [{type: 'object', http: {source: 'req'}}],
|
|
|
|
returns: [{type: 'boolean', name: 'success'}],
|
|
|
|
});
|
|
|
|
|
|
|
|
return request(app).get('/mymodels/customMethod').expect(200);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('rebuilds REST endpoints after a remoteMethod was disabled', () => {
|
|
|
|
app.model(MyModel);
|
|
|
|
app.use(loopback.rest());
|
|
|
|
MyModel.customMethod = function(req, cb) {
|
|
|
|
cb(null, true);
|
|
|
|
};
|
|
|
|
MyModel.remoteMethod('customMethod', {
|
|
|
|
http: {verb: 'get'},
|
|
|
|
accepts: [{type: 'object', http: {source: 'req'}}],
|
|
|
|
returns: [{type: 'boolean', name: 'success'}],
|
|
|
|
});
|
|
|
|
return request(app).get('/mymodels/customMethod').expect(200)
|
|
|
|
.then(() => {
|
|
|
|
MyModel.disableRemoteMethodByName('customMethod');
|
|
|
|
|
|
|
|
return request(app).get('/mymodels/customMethod').expect(404);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
function givenUserModelWithAuth() {
|
2019-10-07 09:45:34 +00:00
|
|
|
const AccessToken = app.registry.getModel('AccessToken');
|
2016-11-15 21:46:23 +00:00
|
|
|
app.model(AccessToken, {dataSource: 'db'});
|
2019-10-07 09:45:34 +00:00
|
|
|
const User = app.registry.getModel('User');
|
2016-11-15 21:46:23 +00:00
|
|
|
// Speed up the password hashing algorithm for tests
|
2016-11-22 14:30:04 +00:00
|
|
|
User.settings.saltWorkFactor = 4;
|
2016-11-15 21:46:23 +00:00
|
|
|
app.model(User, {dataSource: 'db'});
|
2016-05-02 12:53:21 +00:00
|
|
|
|
|
|
|
// NOTE(bajtos) This is puzzling to me. The built-in User & AccessToken
|
|
|
|
// models should come with both relations already set up, i.e. the
|
|
|
|
// following two lines should not be neccessary.
|
|
|
|
// And it does behave that way when only tests in this file are run.
|
|
|
|
// However, when I run the full test suite (all files), the relations
|
|
|
|
// get broken.
|
2016-11-15 21:46:23 +00:00
|
|
|
AccessToken.belongsTo(User, {as: 'user', foreignKey: 'userId'});
|
|
|
|
User.hasMany(AccessToken, {as: 'accessTokens', foreignKey: 'userId'});
|
2016-05-02 12:53:21 +00:00
|
|
|
|
|
|
|
return User;
|
2014-02-04 15:17:32 +00:00
|
|
|
}
|
2016-05-02 12:53:21 +00:00
|
|
|
|
2014-11-21 01:52:11 +00:00
|
|
|
function givenLoggedInUser(cb, done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const credentials = {email: 'user@example.com', password: 'pwd'};
|
|
|
|
const User = app.models.User;
|
2014-02-04 15:17:32 +00:00
|
|
|
User.create(credentials,
|
|
|
|
function(err, user) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2014-02-04 15:17:32 +00:00
|
|
|
User.login(credentials, cb);
|
|
|
|
});
|
|
|
|
}
|
2015-09-19 02:13:30 +00:00
|
|
|
|
|
|
|
describe('shared methods', function() {
|
|
|
|
function getFixturePath(dirName) {
|
|
|
|
return path.join(__dirname, 'fixtures/shared-methods/' + dirName +
|
|
|
|
'/server/server.js');
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('with specific definitions in model-config.json', function() {
|
|
|
|
it('should not be exposed when the definition value is false',
|
2017-12-12 08:33:15 +00:00
|
|
|
function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('model-config-defined-false'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(404, done);
|
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
|
|
|
|
it('should be exposed when the definition value is true', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('model-config-defined-true'));
|
2015-09-19 02:13:30 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(200, done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with default definitions in model-config.json', function() {
|
|
|
|
it('should not be exposed when the definition value is false',
|
2017-12-12 08:33:15 +00:00
|
|
|
function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('model-config-default-false'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(404, done);
|
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
|
|
|
|
it('should be exposed when the definition value is true', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('model-config-default-true'));
|
2015-09-19 02:13:30 +00:00
|
|
|
app.models.Todo.create([
|
2016-11-15 21:46:23 +00:00
|
|
|
{content: 'a'},
|
|
|
|
{content: 'b'},
|
|
|
|
{content: 'c'},
|
2015-09-19 02:13:30 +00:00
|
|
|
], function() {
|
|
|
|
request(app)
|
|
|
|
.del('/todos')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err, res) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
expect(res.body.count).to.equal(3);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with specific definitions in config.json', function() {
|
|
|
|
it('should not be exposed when the definition value is false',
|
2017-12-12 08:33:15 +00:00
|
|
|
function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('config-defined-false'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(404, done);
|
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
|
|
|
|
it('should be exposed when the definition value is true',
|
2017-12-12 08:33:15 +00:00
|
|
|
function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('config-defined-true'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(200, done);
|
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('with default definitions in config.json', function() {
|
|
|
|
it('should not be exposed when the definition value is false',
|
2017-12-12 08:33:15 +00:00
|
|
|
function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('config-default-false'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(404, done);
|
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
|
|
|
|
it('should be exposed when the definition value is true', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('config-default-true'));
|
2015-09-19 02:13:30 +00:00
|
|
|
app.models.Todo.create([
|
2016-11-15 21:46:23 +00:00
|
|
|
{content: 'a'},
|
|
|
|
{content: 'b'},
|
|
|
|
{content: 'c'},
|
2015-09-19 02:13:30 +00:00
|
|
|
], function() {
|
|
|
|
request(app)
|
|
|
|
.del('/todos')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err, res) {
|
|
|
|
if (err) return done(err);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
expect(res.body.count).to.equal(3);
|
2016-05-05 04:09:06 +00:00
|
|
|
|
2015-09-19 02:13:30 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// The fixture in `shared-method/both-configs-set/config.json` has `*:false`
|
|
|
|
// set which disables the REST endpoints for built-in models such as User as
|
|
|
|
// a side effect since tests share the same loopback instance. As a
|
|
|
|
// consequence, this causes the tests in user.integration to fail.
|
|
|
|
describe.skip('with definitions in both config.json and model-config.json',
|
2017-12-12 08:33:15 +00:00
|
|
|
function() {
|
|
|
|
it('should prioritize the settings in model-config.json', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('both-configs-set'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.del('/todos')
|
|
|
|
.expect(404, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should fall back to config.json settings if setting is not found in' +
|
2015-09-19 02:13:30 +00:00
|
|
|
'model-config.json', function(done) {
|
2019-10-07 09:45:34 +00:00
|
|
|
const app = require(getFixturePath('both-configs-set'));
|
2017-12-12 08:33:15 +00:00
|
|
|
request(app)
|
|
|
|
.get('/todos')
|
|
|
|
.expect(404, done);
|
2016-04-01 09:14:26 +00:00
|
|
|
});
|
2017-12-12 08:33:15 +00:00
|
|
|
});
|
2015-09-19 02:13:30 +00:00
|
|
|
});
|
2014-02-04 15:17:32 +00:00
|
|
|
});
|