mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Backend: Add unit tests for internal/entity
This commit is contained in:
@@ -16,6 +16,24 @@ func TestFirstOrCreateCamera(t *testing.T) {
|
||||
t.Fatal("result should not be nil")
|
||||
}
|
||||
|
||||
assert.GreaterOrEqual(t, result.ID, uint(1))
|
||||
})
|
||||
t.Run("camera without make and model", func(t *testing.T) {
|
||||
camera := &Camera{ID: 10000000, CameraSlug: "camera-slug"}
|
||||
|
||||
result := FirstOrCreateCamera(camera)
|
||||
|
||||
if result == nil {
|
||||
t.Fatal("result should not be nil")
|
||||
}
|
||||
|
||||
assert.GreaterOrEqual(t, result.ID, uint(1))
|
||||
})
|
||||
t.Run("not existing model and make", func(t *testing.T) {
|
||||
camera := &Camera{CameraModel: "xxx", CameraMake: "xxx"}
|
||||
|
||||
result := FirstOrCreateCamera(camera)
|
||||
|
||||
assert.GreaterOrEqual(t, result.ID, uint(1))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user