snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
25
timespan/timers_test.go
Normal file
25
timespan/timers_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package timespan
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/traggo/server/generated/gqlmodel"
|
||||
"github.com/traggo/server/test"
|
||||
"github.com/traggo/server/test/fake"
|
||||
)
|
||||
|
||||
func TestTimers(t *testing.T) {
|
||||
db := test.InMemoryDB(t)
|
||||
db.User(5)
|
||||
db.Create(timeSpan1)
|
||||
db.Create(runningTimeSpan)
|
||||
defer db.Close()
|
||||
|
||||
resolver := ResolverForTimeSpan{DB: db.DB}
|
||||
timeSpans, err := resolver.Timers(fake.User(5))
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := []*gqlmodel.TimeSpan{&modelRunningTimeSpan}
|
||||
require.Equal(t, expected, timeSpans)
|
||||
}
|
||||
Reference in New Issue
Block a user