This commit is contained in:
@@ -26,3 +26,30 @@ func TestCSVCompactOmitsActivity(t *testing.T) {
|
||||
t.Fatal("compact CSV contains activity")
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceReportPDFContainsSignatureFields(t *testing.T) {
|
||||
end := int64(3_600_000)
|
||||
pdf := makeServiceReportPDF(
|
||||
[]Entry{{ID: "x", Client: "ACME", Activity: "Router geprüft und Firmware aktualisiert", StartMS: 0, EndMS: &end}},
|
||||
Settings{RoundingMinutes: 1, TimeFormat: "24", Timezone: "UTC"},
|
||||
User{DisplayName: "Max Techniker", Username: "max"},
|
||||
serviceReportMeta{Client: "ACME", Contact: "Erika Kunde", OrderNumber: "SR-42", ReportDate: "14.08.2026"},
|
||||
)
|
||||
for _, want := range [][]byte{[]byte("%PDF-1.4"), []byte("SERVICE-BERICHT"), []byte("ACME"), []byte("Gesamtdauer"), []byte("Unterschrift Kunde"), []byte("Unterschrift Techniker")} {
|
||||
if !bytes.Contains(pdf, want) {
|
||||
t.Fatalf("service report missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWrapPDFText(t *testing.T) {
|
||||
lines := wrapPDFText("eins zwei drei vier", 9)
|
||||
if len(lines) < 2 {
|
||||
t.Fatalf("expected wrapped lines, got %#v", lines)
|
||||
}
|
||||
for _, line := range lines {
|
||||
if len([]rune(line)) > 9 {
|
||||
t.Fatalf("line too long: %q", line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user