chore: fix tests
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user