MCPcopy Index your code
hub / github.com/larksuite/cli / TestParseJSONMap_WithAtFile

Function TestParseJSONMap_WithAtFile

internal/cmdutil/resolve_test.go:220–237  ·  view source on GitHub ↗

Integration: @file flows through ParseJSONMap correctly.

(t *testing.T)

Source from the content-addressed store, hash-verified

218
219// Integration: @file flows through ParseJSONMap correctly.
220func TestParseJSONMap_WithAtFile(t *testing.T) {
221 fio := &localfileio.LocalFileIO{}
222 dir := t.TempDir()
223 TestChdir(t, dir)
224 if err := os.WriteFile("params.json", []byte(`{"folder_token":"abc123","type":"folder"}`), 0o600); err != nil {
225 t.Fatal(err)
226 }
227 got, err := ParseJSONMap("@params.json", "--params", nil, fio)
228 if err != nil {
229 t.Fatalf("unexpected error: %v", err)
230 }
231 if len(got) != 2 {
232 t.Errorf("got %d keys, want 2", len(got))
233 }
234 if got["folder_token"] != "abc123" {
235 t.Errorf("got %v, want folder_token=abc123", got)
236 }
237}
238
239func TestParseOptionalBody_WithAtFile(t *testing.T) {
240 fio := &localfileio.LocalFileIO{}

Callers

nothing calls this directly

Calls 3

TestChdirFunction · 0.85
ParseJSONMapFunction · 0.85
WriteFileMethod · 0.65

Tested by

no test coverage detected