diff --git a/internal/resolvers/youtube/video_resolver_test.go b/internal/resolvers/youtube/video_resolver_test.go index e5a2eefc..14139d41 100644 --- a/internal/resolvers/youtube/video_resolver_test.go +++ b/internal/resolvers/youtube/video_resolver_test.go @@ -160,6 +160,13 @@ func TestVideoResolver(t *testing.T) { inputReq: nil, expectedBytes: []byte(`{"status":200,"thumbnail":"https://example.com/thumbnail.png","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cb%3EVideo%20Title%3C%2Fb%3E%0A%3Cbr%3E%3Cb%3EChannel:%3C%2Fb%3E%20Channel%20Title%0A%3Cbr%3E%3Cb%3EDuration:%3C%2Fb%3E%2000:00:00%0A%3Cbr%3E%3Cb%3EPublished:%3C%2Fb%3E%2012%20Oct%202019%0A%3Cbr%3E%3Cb%3EViews:%3C%2Fb%3E%2050%0A%3Cbr%3E%3Cb%3E%3Cspan%20style=%22color:%20red%3B%22%3EAGE%20RESTRICTED%3C%2Fspan%3E%3C%2Fb%3E%0A%3Cbr%3E%3Cspan%20style=%22color:%20%232ecc71%3B%22%3E10%20likes%3C%2Fspan%3E\u0026nbsp%3B%E2%80%A2\u0026nbsp%3B%3Cspan%20style=%22color:%20%23808892%3B%22%3E5%20comments%3C%2Fspan%3E%0A%3C%2Fdiv%3E%0A"}`), }, + { + label: "Video (Short)", + inputURL: utils.MustParseURL("https://youtube.com/shorts/foobar"), + inputVideoID: "foobar", + inputReq: nil, + expectedBytes: []byte(`{"status":200,"thumbnail":"https://example.com/thumbnail.png","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cb%3EVideo%20Title%3C%2Fb%3E%0A%3Cbr%3E%3Cb%3EChannel:%3C%2Fb%3E%20Channel%20Title%0A%3Cbr%3E%3Cb%3EDuration:%3C%2Fb%3E%2000:00:00%0A%3Cbr%3E%3Cb%3EPublished:%3C%2Fb%3E%2012%20Oct%202019%0A%3Cbr%3E%3Cb%3EViews:%3C%2Fb%3E%2050%0A%3Cbr%3E%3Cb%3E%3Cspan%20style=%22color:%20red%3B%22%3EAGE%20RESTRICTED%3C%2Fspan%3E%3C%2Fb%3E%0A%3Cbr%3E%3Cspan%20style=%22color:%20%232ecc71%3B%22%3E10%20likes%3C%2Fspan%3E\u0026nbsp%3B%E2%80%A2\u0026nbsp%3B%3Cspan%20style=%22color:%20%23808892%3B%22%3E5%20comments%3C%2Fspan%3E%0A%3C%2Fdiv%3E%0A"}`), + }, { label: "404", inputURL: utils.MustParseURL("https://youtube.com/watch?v=404"), @@ -174,6 +181,13 @@ func TestVideoResolver(t *testing.T) { inputReq: nil, expectedBytes: []byte(`{"status":500,"message":"YouTube API returned more than 2 videos"}`), }, + { + label: "Too many videos (Short)", + inputURL: utils.MustParseURL("https://youtube.com/shorts/toomany"), + inputVideoID: "toomany", + inputReq: nil, + expectedBytes: []byte(`{"status":500,"message":"YouTube API returned more than 2 videos"}`), + }, { label: "Unavailable", inputURL: utils.MustParseURL("https://youtube.com/watch?v=unavailable"),