mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Backend: Add tests to internal/entity
This commit is contained in:
36
internal/entity/file_sync_fixtures_test.go
Normal file
36
internal/entity/file_sync_fixtures_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFileSyncMap_Get(t *testing.T) {
|
||||
t.Run("get existing filesync", func(t *testing.T) {
|
||||
r := FileSyncFixtures.Get("FileSync1", 0, "")
|
||||
assert.Equal(t, uint(1000000), r.AccountID)
|
||||
assert.Equal(t, "name for remote sync", r.RemoteName)
|
||||
assert.IsType(t, FileSync{}, r)
|
||||
})
|
||||
t.Run("get not existing filesync", func(t *testing.T) {
|
||||
r := FileSyncFixtures.Get("FileSyncXXX", 123, "new remote name for sync")
|
||||
assert.Equal(t, uint(123), r.AccountID)
|
||||
assert.Equal(t, "new remote name for sync", r.RemoteName)
|
||||
assert.IsType(t, FileSync{}, r)
|
||||
})
|
||||
}
|
||||
|
||||
func TestFileSyncMap_Pointer(t *testing.T) {
|
||||
t.Run("get existing filesync pointer", func(t *testing.T) {
|
||||
r := FileSyncFixtures.Pointer("FileSync1", 0, "")
|
||||
assert.Equal(t, uint(1000000), r.AccountID)
|
||||
assert.Equal(t, "name for remote sync", r.RemoteName)
|
||||
assert.IsType(t, &FileSync{}, r)
|
||||
})
|
||||
t.Run("get not existing filesync pointer", func(t *testing.T) {
|
||||
r := FileSyncFixtures.Pointer("FileSyncYYY", 456, "new remote name for sync pointer")
|
||||
assert.Equal(t, uint(456), r.AccountID)
|
||||
assert.Equal(t, "new remote name for sync pointer", r.RemoteName)
|
||||
assert.IsType(t, &FileSync{}, r)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user