forked from kkdai/youtube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_test.go
More file actions
26 lines (23 loc) · 759 Bytes
/
errors_test.go
File metadata and controls
26 lines (23 loc) · 759 Bytes
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
package youtube
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
func TestErrors(t *testing.T) {
tests := []struct {
err error
expected string
}{
{ErrUnexpectedStatusCode(404), "unexpected status code: 404"},
{ErrPlayabiltyStatus{"invalid", "for that reason"}, "cannot playback and download, status: invalid, reason: for that reason"},
{ErrResponseStatus{}, "no response status found in the server's answer"},
{ErrResponseStatus{Status: "foo"}, "response status: 'foo', no reason given"},
{ErrResponseStatus{Status: "foo", Reason: "bar"}, "response status: 'foo', reason: 'bar'"},
}
for i, tt := range tests {
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.EqualError(t, tt.err, tt.expected)
})
}
}