File tree Expand file tree Collapse file tree 4 files changed +299
-6
lines changed Expand file tree Collapse file tree 4 files changed +299
-6
lines changed Original file line number Diff line number Diff line change 1717 "lint" : " yarn workspaces run lint" ,
1818 "prepare" : " node .husky/install.mjs || true" ,
1919 "typecheck" : " yarn workspaces run typecheck" ,
20- "test:unit" : " cross-env RunEnvironment='dev' vitest run tests/unit --config tests/unit/vitest.config.ts && yarn workspace infra-core-ui run test:unit" ,
20+ "test:unit" : " cross-env RunEnvironment='dev' vitest run --coverage tests/unit --config tests/unit/vitest.config.ts && yarn workspace infra-core-ui run test:unit" ,
2121 "test:unit-ui" : " yarn test:unit --ui" ,
2222 "test:unit-watch" : " vitest tests/unit" ,
2323 "test:live" : " vitest tests/live" ,
3838 "@typescript-eslint/eslint-plugin" : " ^8.0.1" ,
3939 "@typescript-eslint/parser" : " ^8.0.1" ,
4040 "@vitejs/plugin-react" : " ^4.3.1" ,
41+ "@vitest/coverage-istanbul" : " 2.1.9" ,
4142 "@vitest/ui" : " ^2.0.5" ,
4243 "aws-sdk-client-mock" : " ^4.1.0" ,
4344 "concurrently" : " ^9.1.2" ,
Original file line number Diff line number Diff line change 1+ import { expect , test , describe } from "vitest" ;
2+ import { parseSQSPayload } from "../../../src/common/types/sqsMessage.js" ;
3+ import { ZodError } from "zod" ;
4+
5+ describe ( "SQS Message Parsing Tests" , ( ) => {
6+ test ( "Ping message parses correctly" , ( ) => {
7+ const payload = {
8+ metadata : {
9+ reqId : "12345" ,
10+ initiator : "unit-test" ,
11+ } ,
12+ function : "ping" ,
13+ payload : { } ,
14+ } ;
15+ const response = parseSQSPayload ( payload ) ;
16+ expect ( response ) . toStrictEqual ( payload ) ;
17+ } ) ;
18+ test ( "Invalid function doesn't parse" , ( ) => {
19+ const payload = {
20+ metadata : {
21+ reqId : "12345" ,
22+ initiator : "unit-test" ,
23+ } ,
24+ function : "invalid_function" ,
25+ payload : { } ,
26+ } ;
27+ expect ( parseSQSPayload ( payload ) ) . toBeInstanceOf ( ZodError ) ;
28+ } ) ;
29+ } ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ const __dirname = path.dirname(__filename);
88export default defineConfig ( {
99 test : {
1010 setupFiles : "./tests/unit/vitest.setup.ts" ,
11+ coverage : {
12+ provider : "istanbul" ,
13+ include : [ "src/api/**/*.ts" , "src/common/**/*.ts" ] ,
14+ } ,
1115 } ,
1216 resolve : {
1317 alias : {
You can’t perform that action at this time.
0 commit comments