Skip to content

Commit f56e256

Browse files
committed
pass unit tests
1 parent 07917a2 commit f56e256

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

src/routes/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
7777
response: { 200: responseJsonSchema },
7878
},
7979
preValidation: async (request, reply) => {
80-
await fastify.zodValidateBody(request, reply, requestSchema);
80+
await fastify.zodValidateBody(request, reply, postRequestSchema);
8181
},
8282
onRequest: async (request, reply) => {
8383
await fastify.authorize(request, reply, [AppRoles.MANAGER]);

tests/unit/events.test.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { afterAll, expect, test, beforeEach, vi } from "vitest";
2-
import {
3-
ScanCommand,
4-
DynamoDBClient,
5-
PutItemCommand,
6-
} from "@aws-sdk/client-dynamodb";
2+
import { ScanCommand, DynamoDBClient } from "@aws-sdk/client-dynamodb";
73
import { mockClient } from "aws-sdk-client-mock";
84
import init from "../../src/index.js";
95
import { EventGetResponse } from "../../src/routes/events.js";
@@ -12,16 +8,9 @@ import {
128
dynamoTableDataUnmarshalled,
139
dynamoTableDataUnmarshalledUpcomingOnly,
1410
} from "./mockEventData.testdata.js";
15-
import { createJwt } from "./auth.test.js";
16-
import {
17-
GetSecretValueCommand,
18-
SecretsManagerClient,
19-
} from "@aws-sdk/client-secrets-manager";
20-
import { secretJson, secretObject } from "./secret.testdata.js";
21-
import supertest from "supertest";
11+
import { secretObject } from "./secret.testdata.js";
2212

2313
const ddbMock = mockClient(DynamoDBClient);
24-
const smMock = mockClient(SecretsManagerClient);
2514
const jwt_secret = secretObject["jwt_key"];
2615
vi.stubEnv("JwtSigningKey", jwt_secret);
2716

tests/unit/mockEventData.testdata.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,13 @@ const dynamoTableData = [
165165

166166
const dynamoTableDataUnmarshalled = dynamoTableData.map((x: any) => {
167167
const temp = unmarshall(x);
168-
delete temp.id;
169168
delete temp.createdBy;
170169
return temp;
171170
});
172171

173172
const dynamoTableDataUnmarshalledUpcomingOnly = dynamoTableData
174173
.map((x: any) => {
175174
const temp = unmarshall(x);
176-
delete temp.id;
177175
delete temp.createdBy;
178176
return temp;
179177
})

0 commit comments

Comments
 (0)