Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Livestreamfails tests #301

Merged
merged 2 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Dev: Improve Twitter tests. (#293)
- Dev: Improve SevenTV tests. (#294)
- Dev: Improve FrankerFaceZ tests. (#295)
- Dev: Improve Livestreamfails tests. (#297)
- Dev: Improve Livestreamfails tests. (#297, #301)

## 1.2.3

Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/livestreamfails/clip_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ func TestClipResolver(t *testing.T) {
label: "normal",
inputURL: utils.MustParseURL("https://livestreamfails.com/clip/123"),
inputClipID: "123",
expectedBytes: []byte(`{"status":200,"thumbnail":"https://livestreamfails-image-prod.b-cdn.net/image/asd","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2027%20Mar%202022%0A%3C%2Fdiv%3E"}`),
expectedBytes: []byte(`{"status":200,"thumbnail":"https://livestreamfails-image-prod.b-cdn.net/image/asd","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2010%20Nov%202019%0A%3C%2Fdiv%3E"}`),
expectedError: nil,
},
{
label: "normal NSFW",
inputURL: utils.MustParseURL("https://livestreamfails.com/clip/905"),
inputClipID: "905",
expectedBytes: []byte(`{"status":200,"tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cli%3E%3Cb%3E%3Cspan%20style=%22color:%20red%22%3ENSFW%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fli%3E%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2027%20Mar%202022%0A%3C%2Fdiv%3E"}`),
expectedBytes: []byte(`{"status":200,"tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cli%3E%3Cb%3E%3Cspan%20style=%22color:%20red%22%3ENSFW%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fli%3E%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2010%20Nov%202019%0A%3C%2Fdiv%3E"}`),
expectedError: nil,
},
{
Expand Down
5 changes: 3 additions & 2 deletions internal/resolvers/livestreamfails/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ var (
)

func init() {
testTime := time.Date(2019, time.November, 10, 23, 0, 0, 0, time.UTC)
// Normal clip
data["123"] = &ClipAPIResponse{
Category: ClipAPICategory{
Label: "Category Label",
},
CreatedAt: time.Now(),
CreatedAt: testTime,
ImageID: "asd",
IsNSFW: false,
Label: "Clip Label",
Expand All @@ -35,7 +36,7 @@ func init() {
Category: ClipAPICategory{
Label: "Category Label",
},
CreatedAt: time.Now(),
CreatedAt: testTime,
ImageID: "asd",
IsNSFW: true,
Label: "Clip Label",
Expand Down