chore: fix tests
All checks were successful
Go / build (push) Successful in 15s
Release / publish (push) Successful in 1m5s

This commit is contained in:
2025-08-27 22:20:03 +02:00
parent a84994ffd1
commit 8180b38225
3 changed files with 14 additions and 18 deletions

View File

@@ -14,7 +14,6 @@ import (
"time"
"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
"git.schreifuchs.ch/lou-taylor/accounting/internal/jtype"
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/issue"
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/model"
@@ -106,7 +105,7 @@ func TestCreateInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
pdfContent := "mock PDF content"
@@ -124,7 +123,7 @@ func TestCreateInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "invalid", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
mockGenerate: nil, // Not called for invalid body
expectedStatus: http.StatusBadRequest,
@@ -137,7 +136,7 @@ func TestCreateInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
return nil, nil, errors.New("failed to generate invoice")
@@ -152,7 +151,7 @@ func TestCreateInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
// Create a report with zero total duration
@@ -213,7 +212,7 @@ func TestSendInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
@@ -238,7 +237,7 @@ func TestSendInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
@@ -259,7 +258,7 @@ func TestSendInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {
@@ -284,7 +283,7 @@ func TestSendInvoice(t *testing.T) {
Debtor: model.Entity{Name: "Debtor"},
DurationThreshold: "1h", // Changed to string
HourlyRate: 100,
Repos: []string{"repo1"},
Repos: []string{"owner/repo1"},
},
},
mockGenerate: func(creditor, debtor model.Entity, durationThreshold time.Duration, hourlyRate float64, repos []invoice.Repo) (io.ReadCloser, *report.Report, error) {