From 7dcc2fcb1c4975bbb0a16d1ef2bdbdf65dc321aa Mon Sep 17 00:00:00 2001 From: Pradnya Baviskar Date: Thu, 22 Jan 2015 12:32:43 +0530 Subject: [PATCH] Add test case for loopback issue #698 Verify that the following model options change the HTTP path where the model is exposed: { http: { path: 'domain/mymodels' } } --- test/rest.middleware.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/rest.middleware.test.js b/test/rest.middleware.test.js index ac29e7a3..7cec6d7e 100644 --- a/test/rest.middleware.test.js +++ b/test/rest.middleware.test.js @@ -99,6 +99,19 @@ describe('loopback.rest', function() { .expect(200, done); }); + it('allows models to provide a custom HTTP path', function(done) { + var ds = app.dataSource('db', { connector: loopback.Memory }); + var CustomModel = ds.createModel('CustomModel', + { name: String }, + { http: { 'path': 'domain1/CustomModelPath' } + }); + + app.model(CustomModel); + app.use(loopback.rest()); + + request(app).get('/domain1/CustomModelPath').expect(200).end(done); + }); + it('includes loopback.token when necessary', function(done) { givenUserModelWithAuth(); app.enableAuth();