-
Notifications
You must be signed in to change notification settings - Fork 2
/
constructor_test.go
57 lines (52 loc) · 1.52 KB
/
constructor_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
57
package getdoc
import (
"bytes"
"os"
"path"
"testing"
"github.com/stretchr/testify/require"
)
func TestConstructor(t *testing.T) {
data, err := os.ReadFile(path.Join("_testdata", "constructor.html"))
if err != nil {
t.Fatal(err)
}
v, err := ParseConstructor(bytes.NewReader(data))
if err != nil {
t.Fatal(err)
}
expected := &Constructor{
Name: "userProfilePhoto",
Description: []string{"User profile photo."},
Fields: map[string]ParamDescription{
"dc_id": {
Name: "dc_id",
Description: "DC ID where the photo is stored",
},
"flags": {
Name: "flags",
Description: "Flags, see TL conditional fields¹",
Links: []string{"https://core.telegram.org/mtproto/TL-combinators#conditional-fields"},
},
"has_video": {
Name: "has_video",
Description: "Whether an animated profile picture¹ is available for this user",
Links: []string{"https://core.telegram.org/api/files#animated-profile-pictures"},
},
"photo_big": {
Name: "photo_big",
Description: "Location of the file, corresponding to the big profile photo thumbnail",
},
"photo_id": {
Name: "photo_id",
Description: "Identifier of the respective photoParameter added in Layer 2¹",
Links: []string{"https://core.telegram.org/api/layers#layer-2"},
},
"photo_small": {
Name: "photo_small",
Description: "Location of the file, corresponding to the small profile photo thumbnail",
},
},
}
require.Equal(t, expected, v)
}