Skip to content

Commit 07b6765

Browse files
committed
CCM-8572: merge main, rework lambdas
1 parent a9413df commit 07b6765

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+11286
-14858
lines changed

infrastructure/terraform/bin/terraform.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ readonly component_name=$(basename ${component_path});
403403
# verify terraform version matches .tool-versions
404404
echo ${PWD}
405405
tool_version=$(grep "terraform " .tool-versions | cut -d ' ' -f 2)
406-
asdf plugin-add terraform && asdf install terraform "${tool_version}"
406+
asdf plugin add terraform && asdf install terraform "${tool_version}"
407407
current_version=$(terraform --version | head -n 1 | cut -d 'v' -f 2)
408408

409409
if [ -z "${current_version}" ] || [ "${current_version}" != "${tool_version}" ]; then

lambdas/authorizer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@swc/core": "^1.10.1",
1313
"@swc/jest": "^0.2.37",
1414
"@tsconfig/node20": "^20.1.4",
15-
"@types/aws-lambda": "^8.10.145",
15+
"@types/aws-lambda": "^8.10.148",
1616
"@types/jest": "^29.5.14",
1717
"@types/jsonwebtoken": "^9.0.7",
1818
"esbuild": "^0.24.0",
@@ -21,7 +21,7 @@
2121
"typescript": "^5.5.4"
2222
},
2323
"dependencies": {
24-
"@aws-sdk/client-cognito-identity-provider": "^3.693.0",
24+
"@aws-sdk/client-cognito-identity-provider": "3.363.0",
2525
"jsonwebtoken": "^9.0.2",
2626
"jwks-rsa": "^3.1.0",
2727
"jwt-decode": "^4.0.0",

lambdas/backend-api/jest.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { baseJestConfig } from 'nhs-notify-web-template-management-utils';
22
import { pathsToModuleNameMapper } from 'ts-jest';
33
import { compilerOptions } from './tsconfig.json';
4+
import { Config } from 'jest';
45

56
const moduleNameMapperDefaults = pathsToModuleNameMapper(
67
compilerOptions.paths,
@@ -9,11 +10,13 @@ const moduleNameMapperDefaults = pathsToModuleNameMapper(
910
}
1011
);
1112

12-
const jestConfig = {
13+
const jestConfig: Config = {
1314
...baseJestConfig,
1415
moduleNameMapper: moduleNameMapperDefaults,
1516
testEnvironment: 'node',
1617
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
18+
prettierPath: null,
19+
coveragePathIgnorePatterns: ['/test-utils/'],
1720
};
1821

1922
export default jestConfig;

lambdas/backend-api/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"typecheck": "tsc --noEmit"
1010
},
1111
"dependencies": {
12-
"@aws-sdk/client-cognito-identity-provider": "^3.699.0",
13-
"@aws-sdk/client-dynamodb": "^3.696.0",
14-
"@aws-sdk/client-s3": "^3.699.0",
15-
"@aws-sdk/lib-dynamodb": "^3.698.0",
12+
"@aws-sdk/client-cognito-identity-provider": "3.363.0",
13+
"@aws-sdk/client-dynamodb": "3.363.0",
14+
"@aws-sdk/client-s3": "3.363.0",
15+
"@aws-sdk/lib-dynamodb": "3.363.0",
1616
"handlebars": "^4.7.8",
1717
"html-entities": "^2.5.2",
1818
"jsonwebtoken": "^9.0.2",
@@ -25,11 +25,10 @@
2525
"zod": "^3.23.8"
2626
},
2727
"devDependencies": {
28-
"@aws-sdk/types": "3.696.0",
2928
"@swc/core": "^1.10.1",
3029
"@swc/jest": "^0.2.37",
3130
"@tsconfig/node20": "^20.1.4",
32-
"@types/aws-lambda": "^8.10.146",
31+
"@types/aws-lambda": "^8.10.148",
3332
"@types/jest": "^29.5.14",
3433
"@types/jsonwebtoken": "^9.0.7",
3534
"aws-sdk-client-mock": "^4.1.0",

lambdas/backend-api/src/__tests__/index.test.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`errors if event object has invalid GuardDutyMalwareScanStatus tag value 1`] = `
4+
"[
5+
{
6+
"received": "UNKNOWN_STATUS",
7+
"code": "invalid_enum_value",
8+
"options": [
9+
"NO_THREATS_FOUND",
10+
"THREATS_FOUND",
11+
"UNSUPPORTED",
12+
"ACCESS_DENIED",
13+
"FAILED"
14+
],
15+
"path": [
16+
"detail",
17+
"object",
18+
"tags",
19+
"GuardDutyMalwareScanStatus"
20+
],
21+
"message": "Invalid enum value. Expected 'NO_THREATS_FOUND' | 'THREATS_FOUND' | 'UNSUPPORTED' | 'ACCESS_DENIED' | 'FAILED', received 'UNKNOWN_STATUS'"
22+
}
23+
]"
24+
`;
25+
26+
exports[`errors if event object has no GuardDutyMalwareScanStatus tag 1`] = `
27+
"[
28+
{
29+
"expected": "'NO_THREATS_FOUND' | 'THREATS_FOUND' | 'UNSUPPORTED' | 'ACCESS_DENIED' | 'FAILED'",
30+
"received": "undefined",
31+
"code": "invalid_type",
32+
"path": [
33+
"detail",
34+
"object",
35+
"tags",
36+
"GuardDutyMalwareScanStatus"
37+
],
38+
"message": "Required"
39+
}
40+
]"
41+
`;
42+
43+
exports[`errors if event object metadata has invalid file-type 1`] = `
44+
"[
45+
{
46+
"received": "unknown-file-type",
47+
"code": "invalid_enum_value",
48+
"options": [
49+
"pdf-template",
50+
"test-data"
51+
],
52+
"path": [
53+
"detail",
54+
"object",
55+
"metadata",
56+
"file-type"
57+
],
58+
"message": "Invalid enum value. Expected 'pdf-template' | 'test-data', received 'unknown-file-type'"
59+
}
60+
]"
61+
`;
62+
63+
exports[`errors if event object metadata has no file-type 1`] = `
64+
"[
65+
{
66+
"expected": "'pdf-template' | 'test-data'",
67+
"received": "undefined",
68+
"code": "invalid_type",
69+
"path": [
70+
"detail",
71+
"object",
72+
"metadata",
73+
"file-type"
74+
],
75+
"message": "Required"
76+
}
77+
]"
78+
`;
79+
80+
exports[`errors if event object metadata has no owner 1`] = `
81+
"[
82+
{
83+
"code": "invalid_type",
84+
"expected": "string",
85+
"received": "undefined",
86+
"path": [
87+
"detail",
88+
"object",
89+
"metadata",
90+
"owner"
91+
],
92+
"message": "Required"
93+
}
94+
]"
95+
`;
96+
97+
exports[`errors if event object metadata has no template-id 1`] = `
98+
"[
99+
{
100+
"code": "invalid_type",
101+
"expected": "string",
102+
"received": "undefined",
103+
"path": [
104+
"detail",
105+
"object",
106+
"metadata",
107+
"template-id"
108+
],
109+
"message": "Required"
110+
}
111+
]"
112+
`;
113+
114+
exports[`errors if event object metadata has no version-id 1`] = `
115+
"[
116+
{
117+
"code": "invalid_type",
118+
"expected": "string",
119+
"received": "undefined",
120+
"path": [
121+
"detail",
122+
"object",
123+
"metadata",
124+
"version-id"
125+
],
126+
"message": "Required"
127+
}
128+
]"
129+
`;

0 commit comments

Comments
 (0)