Skip to content

Commit 1db50d1

Browse files
committed
fix unit tests
1 parent 69ce787 commit 1db50d1

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

src/api/routes/membership.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const membershipPlugin: FastifyPluginAsync = async (fastify, _options) => {
174174
schema: withTags(["Membership"], {
175175
params: z
176176
.object({ netId: z.string().min(1) })
177-
.refine((data) => !validateNetId(data.netId), {
177+
.refine((data) => validateNetId(data.netId), {
178178
message: "NetID is not valid!",
179179
path: ["netId"],
180180
}),
@@ -191,11 +191,6 @@ const membershipPlugin: FastifyPluginAsync = async (fastify, _options) => {
191191
async (request, reply) => {
192192
const netId = request.params.netId.toLowerCase();
193193
const list = request.query.list || "acmpaid";
194-
if (!validateNetId(netId)) {
195-
throw new ValidationError({
196-
message: `${netId} is not a valid Illinois NetID!`,
197-
});
198-
}
199194
if (fastify.nodeCache.get(`isMember_${netId}_${list}`) !== undefined) {
200195
return reply.header("X-ACM-Data-Source", "cache").send({
201196
netId,

tests/unit/stripe.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe("Test Stripe link creation", async () => {
103103
name: "ValidationError",
104104
id: 104,
105105
message:
106-
'String must contain at least 1 character(s) at "invoiceId"; Number must be greater than or equal to 50 at "invoiceAmountUsd"; String must contain at least 1 character(s) at "contactName"; Required at "contactEmail"',
106+
"body/invoiceId String must contain at least 1 character(s), body/invoiceAmountUsd Number must be greater than or equal to 50, body/contactName String must contain at least 1 character(s), body/contactEmail Required",
107107
});
108108
expect(ddbMock.calls().length).toEqual(0);
109109
expect(smMock.calls().length).toEqual(0);
@@ -130,7 +130,7 @@ describe("Test Stripe link creation", async () => {
130130
error: true,
131131
name: "ValidationError",
132132
id: 104,
133-
message: 'Invalid email at "contactEmail"',
133+
message: "body/contactEmail Invalid email",
134134
});
135135
expect(ddbMock.calls().length).toEqual(0);
136136
expect(smMock.calls().length).toEqual(0);

tests/unit/tickets.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ describe("Test ticket purchase verification", async () => {
199199
expect(responseDataJson).toEqual({
200200
error: true,
201201
id: 104,
202-
message:
203-
'Invalid literal value, expected "merch" at "type", or Required at "ticketId"',
202+
message: "body/ Invalid input",
204203
name: "ValidationError",
205204
});
206205
});
@@ -354,7 +353,7 @@ describe("Test merch purchase verification", async () => {
354353
expect(responseDataJson).toEqual({
355354
error: true,
356355
id: 104,
357-
message: `Required at "email"; Required at "stripePi", or Invalid literal value, expected "ticket" at "type"`,
356+
message: `body/ Invalid input`,
358357
name: "ValidationError",
359358
});
360359
});

yarn.lock

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4818,19 +4818,19 @@ axe-core@^4.10.0:
48184818
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.2.tgz#85228e3e1d8b8532a27659b332e39b7fa0e022df"
48194819
integrity sha512-RE3mdQ7P3FRSe7eqCWoeQ/Z9QXrtniSjp1wUjt5nRC3WIpz5rSCve6o3fsZ2aCpJtrZjSZgjwXAoTO5k4tEI0w==
48204820

4821-
axios@^1.7.3, axios@^1.7.7:
4822-
version "1.7.9"
4823-
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.9.tgz#d7d071380c132a24accda1b2cfc1535b79ec650a"
4824-
integrity sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==
4821+
axios@^1.7.4, axios@^1.8.4:
4822+
version "1.8.4"
4823+
resolved "https://registry.yarnpkg.com/axios/-/axios-1.8.4.tgz#78990bb4bc63d2cae072952d374835950a82f447"
4824+
integrity sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==
48254825
dependencies:
48264826
follow-redirects "^1.15.6"
48274827
form-data "^4.0.0"
48284828
proxy-from-env "^1.1.0"
48294829

4830-
axios@^1.7.4:
4831-
version "1.8.4"
4832-
resolved "https://registry.yarnpkg.com/axios/-/axios-1.8.4.tgz#78990bb4bc63d2cae072952d374835950a82f447"
4833-
integrity sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==
4830+
axios@^1.7.7:
4831+
version "1.7.9"
4832+
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.9.tgz#d7d071380c132a24accda1b2cfc1535b79ec650a"
4833+
integrity sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==
48344834
dependencies:
48354835
follow-redirects "^1.15.6"
48364836
form-data "^4.0.0"
@@ -6610,10 +6610,10 @@ fastify-zod-openapi@^4.1.1:
66106610
fast-json-stringify "^6.0.0"
66116611
fastify-plugin "^5.0.0"
66126612

6613-
fastify@^5.1.0:
6614-
version "5.2.1"
6615-
resolved "https://registry.yarnpkg.com/fastify/-/fastify-5.2.1.tgz#38381800eb26b7e27da72d9ee51c544f0c52ff39"
6616-
integrity sha512-rslrNBF67eg8/Gyn7P2URV8/6pz8kSAscFL4EThZJ8JBMaXacVdVE4hmUcnPNKERl5o/xTiBSLfdowBRhVF1WA==
6613+
fastify@^5.3.2:
6614+
version "5.3.2"
6615+
resolved "https://registry.yarnpkg.com/fastify/-/fastify-5.3.2.tgz#88c895a30c0f67166979077ac8649fe8b205a1b3"
6616+
integrity sha512-AIPqBgtqBAwkOkrnwesEE+dOyU30dQ4kh7udxeGVR05CRGwubZx+p2H8P0C4cRnQT0+EPK4VGea2DTL2RtWttg==
66176617
dependencies:
66186618
"@fastify/ajv-compiler" "^4.0.0"
66196619
"@fastify/error" "^4.0.0"
@@ -6625,9 +6625,9 @@ fastify@^5.1.0:
66256625
find-my-way "^9.0.0"
66266626
light-my-request "^6.0.0"
66276627
pino "^9.0.0"
6628-
process-warning "^4.0.0"
6628+
process-warning "^5.0.0"
66296629
rfdc "^1.3.1"
6630-
secure-json-parse "^3.0.1"
6630+
secure-json-parse "^4.0.0"
66316631
semver "^7.6.0"
66326632
toad-cache "^3.7.0"
66336633

@@ -9063,6 +9063,11 @@ process-warning@^4.0.0:
90639063
resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-4.0.1.tgz#5c1db66007c67c756e4e09eb170cdece15da32fb"
90649064
integrity sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==
90659065

9066+
process-warning@^5.0.0:
9067+
version "5.0.0"
9068+
resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-5.0.0.tgz#566e0bf79d1dff30a72d8bbbe9e8ecefe8d378d7"
9069+
integrity sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==
9070+
90669071
process@^0.11.10:
90679072
version "0.11.10"
90689073
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
@@ -9703,10 +9708,10 @@ secure-json-parse@^2.4.0:
97039708
resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.7.0.tgz#5a5f9cd6ae47df23dba3151edd06855d47e09862"
97049709
integrity sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==
97059710

9706-
secure-json-parse@^3.0.1:
9707-
version "3.0.2"
9708-
resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-3.0.2.tgz#255b03bb0627ba5805f64f384b0a7691d8cb021b"
9709-
integrity sha512-H6nS2o8bWfpFEV6U38sOSjS7bTbdgbCGU9wEM6W14P5H0QOsz94KCusifV44GpHDTu2nqZbuDNhTzu+mjDSw1w==
9711+
secure-json-parse@^4.0.0:
9712+
version "4.0.0"
9713+
resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-4.0.0.tgz#2ee1b7581be38ab348bab5a3e49280ba80a89c85"
9714+
integrity sha512-dxtLJO6sc35jWidmLxo7ij+Eg48PM/kleBsxpC8QJE0qJICe+KawkDQmvCMZUr9u7WKVHgMW6vy3fQ7zMiFZMA==
97109715

97119716
semver@^5.5.0:
97129717
version "5.7.2"

0 commit comments

Comments
 (0)