-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepisodeinfo_test.go
42 lines (36 loc) · 1.38 KB
/
episodeinfo_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
package releaseinfo
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestIsPossibleSpecialEpisode(t *testing.T) {
for idx, test := range []string{
"Under.the.Dome.S02.Special-Inside.Chesters.Mill.HDTV.x264-BAJSKORV",
"Under.the.Dome.S02.Special-Inside.Chesters.Mill.720p.HDTV.x264-BAJSKORV",
"Rookie.Blue.Behind.the.Badge.S05.Special.HDTV.x264-2HD",
} {
result, err := Parse(test)
require.NoError(t, err,
fmt.Sprintf("Row %d should have no parsing error", idx+1))
require.True(t, result.IsPossibleSpecialEpisode(),
fmt.Sprintf("Row %d should be a possible special episode", idx+1))
}
}
func TestNormalizeTitle(t *testing.T) {
for idx, test := range []struct {
title, expected string
}{
{"Under.the.Dome.S02.Special-Inside.Chesters.Mill.HDTV.x264-BAJSKORV", "underthedome"},
{"Under.the.Dome.S02.Special-Inside.Chesters.Mill.720p.HDTV.x264-BAJSKORV", "underthedome"},
{"Rookie.Blue.Behind.the.Badge.S05.Special.HDTV.x264-2HD", "rookiebluebehindthebadge"},
} {
result, err := Parse(test.title)
require.NoError(t, err,
fmt.Sprintf("Row %d should have no parsing error", idx+1))
require.Equal(t, test.expected, result.SeriesTitleInfo.Normalize(),
fmt.Sprintf("Row %d should match normalized title", idx+1))
require.True(t, result.SeriesTitleInfo.Equal(test.expected),
fmt.Sprintf("Row %d should be equal to normalized title", idx+1))
}
}