Skip to content

Commit

Permalink
test: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaschlote committed Nov 19, 2024
1 parent d038bf6 commit c6ac8b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ describe("addPlannedFlightDetails", () => {

addPlannedFlightDetails(mockDoc, userDataMock);

expect(getTotalCompensationClaim).toHaveBeenCalledWith({
startAirport: userDataMock.startAirport,
endAirport: userDataMock.endAirport,
});
expect(getTotalCompensationClaim).toHaveBeenCalled();
expect(mockDoc.text).toHaveBeenCalledWith(
`Streitwert: ${mockCompensation}€`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
mockPdfKitDocument,
mockPdfKitDocumentStructure,
} from "tests/factories/mockPdfKit";
import { PDF_MARGIN_HORIZONTAL } from "~/services/pdf/createPdfKitDocument";
import {
ASSUMED_SETTLEMENT_SECTION_TEXT,
CLAIM_FULL_JUSTIFIED_TEXT,
Expand All @@ -16,7 +17,10 @@ describe("createLegalAssessment", () => {
const mockDoc = mockPdfKitDocument(mockStruct);
createLegalAssessment(mockDoc, mockStruct, userDataMock);

expect(mockDoc.text).toHaveBeenCalledWith(LEGAL_ASSESSMENT_TEXT);
expect(mockDoc.text).toHaveBeenCalledWith(
LEGAL_ASSESSMENT_TEXT,
PDF_MARGIN_HORIZONTAL,
);
});

it("should render document with claim full justified text", () => {
Expand Down
1 change: 1 addition & 0 deletions tests/factories/mockPdfKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export const mockPdfKitDocument = (
return mockStructure;
}),
addPage: vi.fn().mockReturnThis(),
heightOfString: vi.fn().mockReturnThis(),
} as unknown as PDFKit.PDFDocument;
};

0 comments on commit c6ac8b4

Please sign in to comment.