MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / TestFormDataEntries

Function TestFormDataEntries

plugins/jsvm/form_data_test.go:158–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestFormDataEntries(t *testing.T) {
159 t.Parallel()
160
161 data := FormData{}
162 data.Append("a", 1)
163 data.Append("b", 2)
164 data.Append("c", 3)
165 data.Append("a", 4)
166
167 entries := data.Entries()
168
169 rawEntries, err := json.Marshal(entries)
170 if err != nil {
171 t.Fatal(err)
172 }
173
174 if len(entries) != 4 {
175 t.Fatalf("Expected 4 entries")
176 }
177
178 expectedEntries := []string{`["a",1]`, `["a",4]`, `["b",2]`, `["c",3]`}
179 for _, expected := range expectedEntries {
180 if !bytes.Contains(rawEntries, []byte(expected)) {
181 t.Fatalf("Expected entry %s to exists in %s", expected, rawEntries)
182 }
183 }
184}
185
186func TestFormDataToMultipart(t *testing.T) {
187 t.Parallel()

Callers

nothing calls this directly

Calls 2

AppendMethod · 0.95
EntriesMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…