-
Notifications
You must be signed in to change notification settings - Fork 2
/
method_test.go
45 lines (40 loc) · 941 Bytes
/
method_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
package getdoc
import (
"bytes"
"os"
"path"
"testing"
"github.com/stretchr/testify/require"
)
func TestParseMethod(t *testing.T) {
data, err := os.ReadFile(path.Join("_testdata", "method.html"))
if err != nil {
t.Fatal(err)
}
v, err := ParseMethod(bytes.NewReader(data))
if err != nil {
t.Fatal(err)
}
expected := &Method{
Name: "langpack.getDifference",
Description: []string{"Get new strings in languagepack"},
Parameters: map[string]ParamDescription{
"from_version": {
Name: "from_version",
Description: "Previous localization pack version",
},
"lang_code": {
Name: "lang_code",
Description: "Language code",
},
"lang_pack": {
Name: "lang_pack",
Description: "Language pack",
},
},
Errors: []Error{
{Code: 400, Type: "LANG_PACK_INVALID", Description: "The provided language pack is invalid"},
},
}
require.Equal(t, expected, v)
}