Skip to content

Commit 475dde3

Browse files
CCM-12875: Typecheck fixes
1 parent 16717b9 commit 475dde3

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

infrastructure/terraform/components/dl/module_lambda_pdm_mock_api.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module "pdm_mock_lambda" {
2424
function_include_common = true
2525
handler_function_name = "handler"
2626
runtime = "nodejs22.x"
27-
memory = 256
27+
memory = 128
2828
timeout = 30
2929
log_level = var.log_level
3030

lambdas/pdm-mock-lambda/src/__tests__/authenticator.test.ts

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ describe('Authenticator', () => {
3333
});
3434

3535
expect(result.isValid).toBe(true);
36-
expect(result.error).toBeUndefined();
3736
expect(mockGetAccessToken).not.toHaveBeenCalled();
3837
});
3938

@@ -50,10 +49,17 @@ describe('Authenticator', () => {
5049
const result = await authenticator({ headers: {} });
5150

5251
expect(result.isValid).toBe(false);
53-
expect(result.error).toBeDefined();
54-
expect(result.error?.statusCode).toBe(401);
55-
expect(result.error?.body).toContain('ACCESS_DENIED');
56-
expect(result.error?.body).toContain('Missing Authentication Token');
52+
expect(result).toHaveProperty('error');
53+
expect((result as { isValid: false; error: any }).error).toBeDefined();
54+
expect((result as { isValid: false; error: any }).error.statusCode).toBe(
55+
401,
56+
);
57+
expect((result as { isValid: false; error: any }).error.body).toContain(
58+
'ACCESS_DENIED',
59+
);
60+
expect((result as { isValid: false; error: any }).error.body).toContain(
61+
'Missing Authentication Token',
62+
);
5763
});
5864

5965
it('should reject request with invalid token type', async () => {
@@ -71,8 +77,13 @@ describe('Authenticator', () => {
7177
});
7278

7379
expect(result.isValid).toBe(false);
74-
expect(result.error?.statusCode).toBe(401);
75-
expect(result.error?.body).toContain('Invalid Access Token');
80+
expect(result).toHaveProperty('error');
81+
expect((result as { isValid: false; error: any }).error.statusCode).toBe(
82+
401,
83+
);
84+
expect((result as { isValid: false; error: any }).error.body).toContain(
85+
'Invalid Access Token',
86+
);
7687
});
7788

7889
it('should reject request with invalid token value', async () => {
@@ -90,8 +101,13 @@ describe('Authenticator', () => {
90101
});
91102

92103
expect(result.isValid).toBe(false);
93-
expect(result.error?.statusCode).toBe(401);
94-
expect(result.error?.body).toContain('Invalid Access Token');
104+
expect(result).toHaveProperty('error');
105+
expect((result as { isValid: false; error: any }).error.statusCode).toBe(
106+
401,
107+
);
108+
expect((result as { isValid: false; error: any }).error.body).toContain(
109+
'Invalid Access Token',
110+
);
95111
});
96112

97113
it('should handle lowercase authorization header', async () => {
@@ -150,7 +166,10 @@ describe('Authenticator', () => {
150166
});
151167

152168
expect(result.isValid).toBe(false);
153-
expect(result.error?.statusCode).toBe(401);
169+
expect(result).toHaveProperty('error');
170+
expect((result as { isValid: false; error: any }).error.statusCode).toBe(
171+
401,
172+
);
154173
});
155174

156175
it('should handle SSM token retrieval errors gracefully', async () => {

0 commit comments

Comments
 (0)