Backend: Add unit tests for internal/entity

This commit is contained in:
Theresa Gresch 2020-07-12 15:41:30 +02:00
parent 7c1ef53be6
commit b6461dca36
3 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
[{
"SourceFile": "/Users/michael/Downloads/20200511-141648-Berlin-Germany-2020-3ku.mp4",
"ExifToolVersion": 11.85,
"FileName": "gopher-video.mp4",
"FileName": "blue-go-video.mp4",
"Directory": "/Users/michael/Downloads",
"FileSize": "4.4 MB",
"FileModifyDate": "2020:05:14 14:02:58+02:00",

Binary file not shown.

View file

@ -13,7 +13,7 @@ func TestIndex_MediaFile(t *testing.T) {
t.Skip("skipping test in short mode.")
}
t.Run("/gopher-video.mp4", func(t *testing.T) {
t.Run("/blue-go-video.mp4", func(t *testing.T) {
conf := config.TestConfig()
conf.InitializeTestData(t)
@ -24,13 +24,13 @@ func TestIndex_MediaFile(t *testing.T) {
ind := NewIndex(conf, tf, nd, convert)
indexOpt := IndexOptionsAll()
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/gopher-video.mp4")
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/blue-go-video.mp4")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "", mediaFile.metaData.Title)
result := ind.MediaFile(mediaFile, indexOpt, "gopher-video.mp4")
result := ind.MediaFile(mediaFile, indexOpt, "blue-go-video.mp4")
assert.Equal(t, "Blue Gopher", mediaFile.metaData.Title)
assert.Equal(t, IndexStatus("added"), result.Status)
})
@ -46,7 +46,7 @@ func TestIndex_MediaFile(t *testing.T) {
ind := NewIndex(conf, tf, nd, convert)
indexOpt := IndexOptionsAll()
result := ind.MediaFile(nil, indexOpt, "gopher-video.mp4")
result := ind.MediaFile(nil, indexOpt, "blue-go-video.mp4")
assert.Equal(t, IndexStatus("failed"), result.Status)
})