Skip to content

Commit d042294

Browse files
committed
Fix tests
1 parent 31a9d02 commit d042294

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/server/api/src/app/flow-template/cloud-template.controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
5151
async (request) => {
5252
const user = getVerifiedUser(request, publicKey);
5353
if (!user) {
54-
logger.info('User is not authenticated, returning sample templates');
5554
return flowTemplateService.getFlowTemplates({
5655
search: request.query.search,
5756
tags: request.query.tags,
@@ -67,7 +66,6 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
6766
});
6867
}
6968

70-
logger.info('User is authenticated, returning all templates');
7169
return flowTemplateService.getFlowTemplates({
7270
search: request.query.search,
7371
tags: request.query.tags,

packages/server/api/test/integration/cloud/cloud/cloud-auth.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ describe('getVerifiedUser', () => {
6363

6464
const result = getVerifiedUser(mockRequest, publicKey);
6565

66-
expect(jwt.verify).toHaveBeenCalledWith('header-token', publicKey);
66+
expect(jwt.verify).toHaveBeenCalledWith('header-token', publicKey, {
67+
algorithms: ['RS256'],
68+
});
6769
expect(result).toEqual(payload);
6870
});
6971

@@ -77,7 +79,9 @@ describe('getVerifiedUser', () => {
7779

7880
const result = getVerifiedUser(mockRequest, publicKey);
7981

80-
expect(jwt.verify).toHaveBeenCalledWith('cookie-token', publicKey);
82+
expect(jwt.verify).toHaveBeenCalledWith('cookie-token', publicKey, {
83+
algorithms: ['RS256'],
84+
});
8185
expect(result).toEqual(payload);
8286
});
8387

@@ -93,6 +97,8 @@ describe('getVerifiedUser', () => {
9397
const result = getVerifiedUser(mockRequest, publicKey);
9498

9599
expect(result).toBeUndefined();
96-
expect(jwt.verify).toHaveBeenCalledWith('bad-token', publicKey);
100+
expect(jwt.verify).toHaveBeenCalledWith('bad-token', publicKey, {
101+
algorithms: ['RS256'],
102+
});
97103
});
98104
});

0 commit comments

Comments
 (0)