Skip to content

Commit

Permalink
change viderverhandlung sentences in pdf (#1782)
Browse files Browse the repository at this point in the history
* change viderverhandlung sentences in pdf

* fix videoverhandlung statement in test

* add return type to function

* add new lines between tests
  • Loading branch information
judithmh authored Feb 25, 2025
1 parent 45618bf commit b3c8178
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import {
STATEMENT_CLAIM_TITLE_TEXT,
} from "../createStatementClaim";

const STATEMENT_VIDEO_TRIAL_AGREEMENT =
"Ich stimme der Durchführung einer Videoverhandlung (§ 128a ZPO) zu.";
const STATEMENT_VIDEO_TRIAL_NO_AGREEMENT =
"Ich stimme der Durchführung einer Videoverhandlung (§ 128a ZPO) nicht zu.";

const STATEMENT_VIDEO_TRIAL_REQUEST =
"Die Teilnahme an der mündlichen Verhandlung per Video gemäß § 128a ZPO wird beantragt.";
const STATEMENT_VIDEO_TRIAL_CONCERNS =
"Gegen die Durchführung einer Videoverhandlung bestehen gemäß § 253 Abs. 3 Nr. 4 ZPO Bedenken.";
describe("createStatementClaim", () => {
beforeEach(() => {
vi.mock(
Expand Down Expand Up @@ -98,44 +97,86 @@ describe("createStatementClaim", () => {
});

describe("createStatementClaim - videoverhandlung logic", () => {
it("should include videoverhandlung sentence when videoverhandlung is yes", () => {
it("should include videoverhandlung request sentence when videoverhandlung is yes", () => {
const mockStruct = mockPdfKitDocumentStructure();
const mockDoc = mockPdfKitDocument(mockStruct);

const userDataMockWithVersaeumnisurteil = {
const userDataMockWithVideorverhandlungRequest = {
...userDataMock,
videoverhandlung: "yes",
} satisfies FluggastrechtContext;

createStatementClaim(
mockDoc,
mockStruct,
userDataMockWithVersaeumnisurteil,
userDataMockWithVideorverhandlungRequest,
);

expect(mockDoc.text).toHaveBeenCalledWith(
STATEMENT_VIDEO_TRIAL_AGREEMENT,
STATEMENT_VIDEO_TRIAL_REQUEST,
PDF_MARGIN_HORIZONTAL,
);
});

it("should not include videoverhandlung sentence when videoverhandlung is no", () => {
it("should include the sentence about videoverhandlung concerns when answer is no", () => {
const mockStruct = mockPdfKitDocumentStructure();
const mockDoc = mockPdfKitDocument(mockStruct);

const userDataMockWithoutVersaeumnisurteil = {
const userDataMockWithVideoTrialConcerns = {
...userDataMock,
videoverhandlung: "no",
} satisfies FluggastrechtContext;

createStatementClaim(
mockDoc,
mockStruct,
userDataMockWithoutVersaeumnisurteil,
userDataMockWithVideoTrialConcerns,
);

expect(mockDoc.text).toHaveBeenCalledWith(
STATEMENT_VIDEO_TRIAL_NO_AGREEMENT,
STATEMENT_VIDEO_TRIAL_CONCERNS,
PDF_MARGIN_HORIZONTAL,
);
});

it("should not include videoverhandlung concerns if answer is noSpecification", () => {
const mockStruct = mockPdfKitDocumentStructure();
const mockDoc = mockPdfKitDocument(mockStruct);

const userDataMockWithVideoverhandlungNoSpecification = {
...userDataMock,
videoverhandlung: "noSpecification",
} satisfies FluggastrechtContext;

createStatementClaim(
mockDoc,
mockStruct,
userDataMockWithVideoverhandlungNoSpecification,
);

expect(mockDoc.text).not.toHaveBeenCalledWith(
STATEMENT_VIDEO_TRIAL_CONCERNS,
PDF_MARGIN_HORIZONTAL,
);
});

it("should not include videoverhandlung request if answer is noSpecification", () => {
const mockStruct = mockPdfKitDocumentStructure();
const mockDoc = mockPdfKitDocument(mockStruct);

const userDataMockWithVideoverhandlungNoSpecification = {
...userDataMock,
videoverhandlung: "noSpecification",
} satisfies FluggastrechtContext;

createStatementClaim(
mockDoc,
mockStruct,
userDataMockWithVideoverhandlungNoSpecification,
);

expect(mockDoc.text).not.toHaveBeenCalledWith(
STATEMENT_VIDEO_TRIAL_REQUEST,
PDF_MARGIN_HORIZONTAL,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ export const STATEMENT_CLAIM_SUBTITLE_TEXT =
export const STATEMENT_CLAIM_COURT_SENTENCE =
"Sofern die gesetzlichen Voraussetzungen vorliegen, wird hiermit der Erlass eines Versäumnisurteils gem. § 331 Abs. 1 und Abs. 3 ZPO gestellt.";

const videoTrialAgreement = (videoverhandlung: string | undefined) => {
return `Ich stimme der Durchführung einer Videoverhandlung (§ 128a ZPO) ${videoverhandlung === "yes" ? "" : "nicht "}zu.`;
const videoTrialAgreement = (videoverhandlung: string | undefined): string => {
const responses: Record<string, string> = {
yes: "Die Teilnahme an der mündlichen Verhandlung per Video gemäß § 128a ZPO wird beantragt.",
no: "Gegen die Durchführung einer Videoverhandlung bestehen gemäß § 253 Abs. 3 Nr. 4 ZPO Bedenken.",
noSpecification: "",
};
return responses[videoverhandlung ?? ""];
};

export const createStatementClaim = (
Expand Down

0 comments on commit b3c8178

Please sign in to comment.