Skip to content

Commit

Permalink
fix: only add attachments in pkh wertsachen when needed (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekl176 authored Oct 24, 2024
1 parent 31394cf commit d8aa765
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/services/pdf/prozesskostenhilfe/G_eigentum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ export const fillBargeldOderWertgegenstaende: PkhPdfFillFunction = ({
: [];
const hasBargeldOderWertgegenstaende =
hasWertsache === "yes" || hasGeldanlage === "yes";
pdfValues.nein_43.value = !hasBargeldOderWertgegenstaende;
if (!hasBargeldOderWertgegenstaende) {
pdfValues.nein_43.value = true;
return { pdfValues };
}

pdfValues.ja_39.value = hasBargeldOderWertgegenstaende;
if (bargeld.length + (wertsachen?.length ?? 0) === 1) {
const singleBargeld = bargeld[0];
Expand Down
12 changes: 12 additions & 0 deletions app/services/pdf/prozesskostenhilfe/__test__/G_eigentum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ describe("G_eigentum", () => {
});

describe("fillBargeldOderWertgegenstaende", () => {
it("should not mention attachments when none exist", () => {
const { pdfValues, attachment } = fillBargeldOderWertgegenstaende({
userData: {
hasBankkonto: "yes",
},
pdfValues: pdfParams,
});
expect(
pdfValues.artdesKontosKontoinhaberKreditinstitut.value,
).toBeUndefined();
expect(attachment?.length).toBeUndefined();
});
it("should indicate if the user has bargeld or wertgegenstaende", () => {
let { pdfValues } = fillBargeldOderWertgegenstaende({
userData: {
Expand Down

0 comments on commit d8aa765

Please sign in to comment.