-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconstants_test.go
56 lines (45 loc) · 1.01 KB
/
constants_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) Liam Stanley <liam@liam.sh>. All rights reserved. Use of
// this source code is governed by the MIT license that can be found in
// the LICENSE file.
//nolint:forbidigo
package ytdlp
import (
"testing"
"time"
)
func TestConstant_ValidateMain(t *testing.T) {
if Channel == "" {
t.Fatal("Channel is empty")
}
if Version == "" {
t.Fatal("Version is empty")
}
_, err := time.Parse("2006.01.02", Version)
if err != nil {
t.Fatalf("failed to parse version: %v", err)
}
}
func TestConstant_ValidateExtractors(t *testing.T) {
if len(SupportedExtractors) == 0 {
t.Fatal("SupportedExtractors is empty")
}
withDescriptions := 0
withAgeLimit := 0
for _, e := range SupportedExtractors {
if e.Name == "" {
t.Fatal("extractor has no name")
}
if e.Description != "" {
withDescriptions++
}
if e.AgeLimit != 0 {
withAgeLimit++
}
}
if withDescriptions == 0 {
t.Fatal("no extractors have descriptions")
}
if withAgeLimit == 0 {
t.Fatal("no extractors have age limits")
}
}