Tests: Add tests for internal/entity
This commit is contained in:
parent
bd8b5d9954
commit
539562368e
1 changed files with 19 additions and 0 deletions
|
@ -23,3 +23,22 @@ func TestPhoto_QualityScore(t *testing.T) {
|
|||
assert.Equal(t, 2, PhotoFixtures.Pointer("Photo15").QualityScore())
|
||||
})
|
||||
}
|
||||
|
||||
func TestPhoto_UpdateQuality(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
p := &Photo{PhotoQuality: -1}
|
||||
err := p.UpdateQuality()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, -1, p.PhotoQuality)
|
||||
})
|
||||
t.Run("low quality expected", func(t *testing.T) {
|
||||
p := &Photo{PhotoQuality: 0, PhotoFavorite: true}
|
||||
err := p.UpdateQuality()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, 5, p.PhotoQuality)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue