mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
refactor(server): use time.Duration for timeout values
Instead of converting at the very last moment, it's simpler and more readable to use time.Duration ASAP.
This commit is contained in:
parent
ed3bf59356
commit
71af68becd
4 changed files with 20 additions and 11 deletions
|
@ -1776,12 +1776,22 @@ func TestHTTPServerTimeout(t *testing.T) {
|
|||
t.Fatalf(`Parsing failure: %v`, err)
|
||||
}
|
||||
|
||||
expected := 342
|
||||
expected := 342 * time.Second
|
||||
result := opts.HTTPServerTimeout()
|
||||
|
||||
if result != expected {
|
||||
t.Fatalf(`Unexpected HTTP_SERVER_TIMEOUT value, got %d instead of %d`, result, expected)
|
||||
}
|
||||
|
||||
sorted := opts.SortedOptions(false)
|
||||
i := slices.IndexFunc(sorted, func(opt *option) bool {
|
||||
return opt.Key == "HTTP_SERVER_TIMEOUT"
|
||||
})
|
||||
|
||||
expectedSerialized := 342
|
||||
if got := sorted[i].Value; got != expectedSerialized {
|
||||
t.Fatalf(`Unexpected value in option output, got %q instead of %q`, got, expectedSerialized)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultHTTPServerTimeoutValue(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue