Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions server/src/module/ats/__tests__/ats.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ function mockCacheMiss() {

function mockValidPdf(text = VALID_RESUME_TEXT) {
vi.mocked(PDFParse).mockImplementation(
() =>
({
function () {
return {
getText: vi.fn().mockResolvedValue({ text }),
destroy: vi.fn().mockResolvedValue(undefined),
}) as any,
} as any;
}
);
}

Expand Down Expand Up @@ -183,11 +184,12 @@ describe("AtsService", () => {
mockUserOwnsResume();
mockCacheMiss();
vi.mocked(PDFParse).mockImplementation(
() =>
({
function () {
return {
getText: vi.fn().mockResolvedValue({ text: "too short" }),
destroy: vi.fn().mockResolvedValue(undefined),
}) as any,
} as any;
}
);

await expect(
Expand Down Expand Up @@ -466,11 +468,12 @@ describe("AtsService", () => {
it("throws when PDF text extraction yields insufficient content", async () => {
mockUserOwnsResume();
vi.mocked(PDFParse).mockImplementation(
() =>
({
function () {
return {
getText: vi.fn().mockResolvedValue({ text: "tiny" }),
destroy: vi.fn().mockResolvedValue(undefined),
}) as any,
} as any;
}
);

await expect(
Expand Down
2 changes: 1 addition & 1 deletion server/src/module/leetcode/leetcode.validation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod";

export const leetcodeCalendarSchema = z.object({
username: z.string().min(1).max(50, "Username too long"),
username: z.string().min(1).max(50, "Username too long").regex(/^[a-zA-Z0-9_-]+$/, "Invalid username format"),
});

export const leetcodeCalendarQuerySchema = z.object({
Expand Down
Loading