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' } }
This commit is contained in:
Pradnya Baviskar 2015-01-22 12:32:43 +05:30 committed by Miroslav Bajtoš
parent a0d9bb1b18
commit 7dcc2fcb1c
1 changed files with 13 additions and 0 deletions

View File

@ -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();