Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanahuckova committed Nov 20, 2024
1 parent 193e327 commit b0ff46a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions backend/gtime/gtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestParseInterval(t *testing.T) {
{inp: "2w", duration: 2 * 168 * time.Hour},
{inp: "1M", duration: time.Duration(daysInMonth * 24 * int(time.Hour))},
{inp: "1y", duration: time.Duration(daysInYear * 24 * int(time.Hour))},
{inp: "invalid-duration", err: regexp.MustCompile(`^time: invalid duration "?invalid-duration"?$`)},
{inp: "invalid-duration", err: regexp.MustCompile(`time: invalid duration "?invalid-duration"?$`)},
}
for i, tc := range tcs {
t.Run(fmt.Sprintf("testcase %d", i), func(t *testing.T) {
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestParseDuration(t *testing.T) {
{inp: "1M", duration: time.Duration(730.5 * float64(time.Hour))},
{inp: "1y", duration: 365.25 * 24 * time.Hour},
{inp: "5y", duration: 5 * 365.25 * 24 * time.Hour},
{inp: "invalid-duration", err: regexp.MustCompile(`^time: invalid duration "?invalid-duration"?$`)},
{inp: "invalid-duration", err: regexp.MustCompile(`time: invalid duration "?invalid-duration"?$`)},
}
for i, tc := range tcs {
t.Run(fmt.Sprintf("testcase %d", i), func(t *testing.T) {
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestParseIntervalStringToTimeDuration(t *testing.T) {
{inp: "1M", duration: time.Duration(730.5 * float64(time.Hour))},
{inp: "1y", duration: 365.25 * 24 * time.Hour},
{inp: "5y", duration: 5 * 365.25 * 24 * time.Hour},
{inp: "invalid-duration", err: regexp.MustCompile(`^time: invalid duration "?invalid-duration"?$`)},
{inp: "invalid-duration", err: regexp.MustCompile(`time: invalid duration "?invalid-duration"?$`)},
// ParseIntervalStringToTimeDuration specific conditions
{inp: "10", duration: 10 * time.Second},
{inp: "<10s>", duration: 10 * time.Second},
Expand Down
1 change: 0 additions & 1 deletion experimental/errorsource/error_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestResponseWithOptions(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
res := Response(tc.err)
require.Error(t, res.Error)
require.Equal(t, tc.expStatus, res.Status)
require.Equal(t, tc.expErrorMessage, res.Error.Error())
require.Equal(t, tc.expErrorSource, res.ErrorSource)
})
Expand Down

0 comments on commit b0ff46a

Please sign in to comment.