summaryrefslogtreecommitdiff
path: root/internal/reports/timesheet_test.go
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-08-13 16:48:58 -0600
committerT <t@tjp.lol>2025-08-13 16:49:20 -0600
commit7d0d21ba8663ab7ff777a06f4b113337fa717ff3 (patch)
treef06d8691fd13bee6ebccfc17a08c599bd5710705 /internal/reports/timesheet_test.go
parent5c3554c7e49abe263faf54c61e435ba1d5202d27 (diff)
go module in git.tjp.lol
Diffstat (limited to 'internal/reports/timesheet_test.go')
-rw-r--r--internal/reports/timesheet_test.go17
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
+}
+