Fix method setup in authorization-scopes.test

Fix the code builing a scoped method to correctly handle the case
when the setup method is called twice and the previously defined
method has to be overriden with new remoting metadata.
This commit is contained in:
Miroslav Bajtoš 2017-04-10 12:19:20 +02:00
parent 9c63abef52
commit d95ec66a23
No known key found for this signature in database
GPG Key ID: 797723F23CE0A94A
1 changed files with 4 additions and 0 deletions

View File

@ -82,6 +82,10 @@ describe('Authorization scopes', () => {
}
function givenRemoteMethodWithCustomScope() {
// Delete any previosly registered instance of the method "scoped"
User.sharedClass._methods = User.sharedClass._methods
.filter(m => m.name !== 'scoped');
const accessScopes = arguments[0] || [CUSTOM_SCOPE];
User.scoped = function(cb) { cb(); };
User.remoteMethod('scoped', {