From b75d78761cfa1876346de726ed5258da08c88fbb Mon Sep 17 00:00:00 2001 From: Frank Kong Date: Thu, 2 May 2024 22:53:12 -0400 Subject: [PATCH] chore(scaffolder-backend): update unit tests for router Signed-off-by: Frank Kong --- .../scaffolder-backend/src/service/router.test.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/src/service/router.test.ts b/plugins/scaffolder-backend/src/service/router.test.ts index 4443b28d09..c129859c49 100644 --- a/plugins/scaffolder-backend/src/service/router.test.ts +++ b/plugins/scaffolder-backend/src/service/router.test.ts @@ -235,6 +235,11 @@ describe('createRouter', () => { result: AuthorizeResult.ALLOW, }, ]); + jest.spyOn(permissionApi, 'authorize').mockImplementation(async () => [ + { + result: AuthorizeResult.ALLOW, + }, + ]); }); afterEach(() => { @@ -741,6 +746,11 @@ data: {"id":1,"taskId":"a-random-id","type":"completion","createdAt":"","body":{ result: AuthorizeResult.ALLOW, }, ]); + jest.spyOn(permissionApi, 'authorize').mockImplementation(async () => [ + { + result: AuthorizeResult.ALLOW, + }, + ]); }); afterEach(() => { @@ -895,11 +905,6 @@ data: {"id":1,"taskId":"a-random-id","type":"completion","createdAt":"","body":{ it('filters steps that the user is not authorized to see', async () => { jest .spyOn(permissionApi, 'authorizeConditional') - .mockImplementationOnce(async () => [ - { - result: AuthorizeResult.ALLOW, - }, - ]) .mockImplementation(async () => [ { result: AuthorizeResult.ALLOW,