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:
23
device/utils_test.go
Normal file
23
device/utils_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package device
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/traggo/server/model"
|
||||
"github.com/traggo/server/test"
|
||||
)
|
||||
|
||||
func assertDeviceExist(t *testing.T, db *test.Database, expected model.Device) {
|
||||
foundDevice := new(model.Device)
|
||||
find := db.Find(foundDevice, expected.ID)
|
||||
require.Nil(t, find.Error)
|
||||
require.NotNil(t, foundDevice)
|
||||
require.Equal(t, expected, *foundDevice)
|
||||
}
|
||||
|
||||
func assertDeviceCount(t *testing.T, db *test.Database, expected int) {
|
||||
count := new(int)
|
||||
db.Model(new(model.Device)).Count(count)
|
||||
require.Equal(t, expected, *count)
|
||||
}
|
||||
Reference in New Issue
Block a user