diff options
Diffstat (limited to 'internal/reports/timesheet_test.go')
-rw-r--r-- | internal/reports/timesheet_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/internal/reports/timesheet_test.go b/internal/reports/timesheet_test.go index 8c0ac52..ed35c86 100644 --- a/internal/reports/timesheet_test.go +++ b/internal/reports/timesheet_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "punchcard/internal/queries" - "punchcard/templates" + "git.tjp.lol/punchcard/internal/queries" + "git.tjp.lol/punchcard/templates" ) func TestGenerateTimesheetData(t *testing.T) { @@ -217,7 +217,7 @@ func TestConvertToTimesheetEntries(t *testing.T) { entries: []timesheetEntryData{ { TimeEntryID: 2, - StartTime: mustParseTime("2025-07-10T18:00:00Z"), // 6:00 PM UTC + StartTime: mustParseTime("2025-07-10T18:00:00Z"), // 6:00 PM UTC EndTime: sql.NullTime{Time: mustParseTime("2025-07-10T19:00:00Z"), Valid: true}, // 7:00 PM UTC Description: sql.NullString{String: "Meeting", Valid: true}, DurationSeconds: 3600, // 1 hour @@ -373,13 +373,13 @@ func TestTimesheetTypstTemplateCompilation(t *testing.T) { }` dataFile := filepath.Join(tempDir, "data.json") - if err := os.WriteFile(dataFile, []byte(testData), 0644); err != nil { + if err := os.WriteFile(dataFile, []byte(testData), 0o644); err != nil { t.Fatalf("Failed to write test data file: %v", err) } // Write Typst template to temp directory typstFile := filepath.Join(tempDir, "timesheet.typ") - if err := os.WriteFile(typstFile, []byte(templates.TimesheetTemplate), 0644); err != nil { + if err := os.WriteFile(typstFile, []byte(templates.TimesheetTemplate), 0o644); err != nil { t.Fatalf("Failed to write Typst template: %v", err) } @@ -502,12 +502,12 @@ func TestGenerateDefaultTimesheetFilename(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := GenerateDefaultTimesheetFilename(tt.clientName, tt.projectName, dateRange) - + // Check that the filename starts with the expected pattern if len(result) < len(tt.want) || result[:len(tt.want)] != tt.want { t.Errorf("GenerateDefaultTimesheetFilename() prefix = %s, want prefix %s", result, tt.want) } - + // Check that it ends with .pdf if result[len(result)-4:] != ".pdf" { t.Errorf("GenerateDefaultTimesheetFilename() should end with .pdf, got %s", result) @@ -538,4 +538,5 @@ func abs(x float64) float64 { return -x } return x -}
\ No newline at end of file +} + |