MCPcopy
hub / github.com/larksuite/cli / TestResolveFilename

Function TestResolveFilename

internal/client/response_test.go:94–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestResolveFilename(t *testing.T) {
95 tests := []struct {
96 name string
97 headers map[string]string
98 want string
99 }{
100 {
101 "from content-type pdf",
102 map[string]string{"Content-Type": "application/pdf"},
103 "download.pdf",
104 },
105 {
106 "from content-type png",
107 map[string]string{"Content-Type": "image/png"},
108 "download.png",
109 },
110 {
111 "unknown type",
112 map[string]string{"Content-Type": "application/octet-stream"},
113 "download.bin",
114 },
115 {
116 "empty content-type",
117 map[string]string{},
118 "download.bin",
119 },
120 }
121 for _, tt := range tests {
122 t.Run(tt.name, func(t *testing.T) {
123 resp := newApiResp([]byte("data"), tt.headers)
124 got := ResolveFilename(resp)
125 if got != tt.want {
126 t.Errorf("ResolveFilename() = %q, want %q", got, tt.want)
127 }
128 })
129 }
130}
131
132func TestMimeToExt_Extended(t *testing.T) {
133 tests := []struct {

Callers

nothing calls this directly

Calls 3

newApiRespFunction · 0.85
ResolveFilenameFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected