Skip to content

Commit f8148cd

Browse files
committed
1 parent 5902480 commit f8148cd

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package search
2+
3+
import "testing"
4+
5+
func TestMetadataJSONScanIncludesVideoPlaybackFields(t *testing.T) {
6+
var meta metadataJSON
7+
if err := meta.Scan([]byte(`{
8+
"width": 1920,
9+
"height": 1080,
10+
"duration": "12m34s",
11+
"mime": "video/x-matroska",
12+
"thumb": "thumbs/video.jpg",
13+
"playback": "playback/video.mp4",
14+
"playbackMime": "video/mp4",
15+
"hls": "hls/video/index.m3u8",
16+
"processing": true
17+
}`)); err != nil {
18+
t.Fatalf("Scan(): %v", err)
19+
}
20+
21+
got := meta.toDomain()
22+
if got.Playback != "playback/video.mp4" {
23+
t.Fatalf("Playback = %q", got.Playback)
24+
}
25+
if got.PlaybackMIME != "video/mp4" {
26+
t.Fatalf("PlaybackMIME = %q", got.PlaybackMIME)
27+
}
28+
if got.HLS != "hls/video/index.m3u8" {
29+
t.Fatalf("HLS = %q", got.HLS)
30+
}
31+
if !got.Processing {
32+
t.Fatal("Processing = false, want true")
33+
}
34+
}

0 commit comments

Comments
 (0)