Do not add isStatic properties to method settings

Closes #3529
This commit is contained in:
Jürg Lehni 2017-08-15 18:09:16 +02:00
parent deec84f3b5
commit a736f782af
2 changed files with 15 additions and 1 deletions

View File

@ -273,7 +273,7 @@ Registry.prototype._defineRemoteMethods = function(ModelCtor, methods) {
if (typeof meta.isStatic !== 'boolean') {
key = isStatic ? key : m[1];
meta.isStatic = isStatic;
meta = Object.assign({}, meta, {isStatic});
} else if (meta.isStatic && m) {
throw new Error(g.f('Remoting metadata for %s.%s {{"isStatic"}} does ' +
'not match new method name-based style.', ModelCtor.modelName, key));

View File

@ -1032,4 +1032,18 @@ describe.onServer('Remote Methods', function() {
});
}
});
describe('Create Model with remote methods from JSON description', function() {
it('does not add isStatic properties to the method settings', function() {
const app = loopback();
const Foo = app.registry.createModel({
name: 'Foo',
methods: {
staticMethod: {},
},
});
app.model(Foo);
expect(app.models.Foo.settings.methods.staticMethod).to.eql({});
});
});
});