From d95ec66a23aceaadd1487db89d8dee1c1404ac6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 10 Apr 2017 12:19:20 +0200 Subject: [PATCH] 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. --- test/authorization-scopes.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/authorization-scopes.test.js b/test/authorization-scopes.test.js index 797cbd48..5dd76d01 100644 --- a/test/authorization-scopes.test.js +++ b/test/authorization-scopes.test.js @@ -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', {