Merge pull request #363 from strongloop/feature/add-test-for-model-remote-methods

test: add check of Model remote methods
This commit is contained in:
Miroslav Bajtoš 2014-07-03 08:50:07 +02:00
commit 9767b88e03
1 changed files with 29 additions and 0 deletions

View File

@ -66,4 +66,33 @@ describe('remoting - integration', function () {
});
});
describe('Model', function() {
it('has expected remote methods', function() {
var storeClass = app.handler('rest').adapter
.getClasses()
.filter(function(c) { return c.name === 'store'; })[0];
var methods = storeClass.methods
.map(function(m) {
return [
m.name + '()',
m.getHttpMethod(),
m.getFullPath()
].join(' ');
});
// The list of methods is from docs:
// http://docs.strongloop.com/display/LB/Exposing+models+over+a+REST+API
expect(methods).to.include.members([
'create() POST /stores',
'upsert() PUT /stores',
'exists() GET /stores/:id/exists',
'findById() GET /stores/:id',
'find() GET /stores',
'findOne() GET /stores/findOne',
'deleteById() DELETE /stores/:id',
'count() GET /stores/count',
'prototype.updateAttributes() PUT /stores/:id',
]);
});
});
});