Files
upstream-traggo/timespan/utils_test.go
upstream-mirror cda7c1a474
Some checks failed
build / build (push) Failing after 3s
snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 05:24:45 +05:00

24 lines
638 B
Go

package timespan
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/traggo/server/model"
"github.com/traggo/server/test"
)
func assertTimeSpanExist(t *testing.T, db *test.Database, expected model.TimeSpan) {
found := new(model.TimeSpan)
find := db.Preload("Tags").Where("user_id = ?", expected.UserID).Where("id = ?", expected.ID).Find(found)
require.Nil(t, find.Error)
require.NotNil(t, found)
require.Equal(t, expected, *found)
}
func assertTimeSpanCount(t *testing.T, db *test.Database, expected int) {
count := new(int)
db.Model(new(model.TimeSpan)).Count(count)
require.Equal(t, expected, *count)
}