MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestJSONOperationOutputContractShape

Function TestJSONOperationOutputContractShape

cmd/json_contract_test.go:1311–1329  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1309}
1310
1311func TestJSONOperationOutputContractShape(t *testing.T) {
1312 encoded, err := json.Marshal(newJSONOperationOutput(nil, nil, nil))
1313 if err != nil {
1314 t.Fatalf("marshal operation output: %v", err)
1315 }
1316
1317 var raw map[string]json.RawMessage
1318 if err := json.Unmarshal(encoded, &raw); err != nil {
1319 t.Fatalf("decode operation output: %v", err)
1320 }
1321 for _, key := range []string{"ok", "schema_version", "command", "input", "results", "warnings"} {
1322 if _, ok := raw[key]; !ok {
1323 t.Fatalf("operation output = %s, missing %q", encoded, key)
1324 }
1325 }
1326 if len(raw) != 6 {
1327 t.Fatalf("operation output = %s, want only ok/schema_version/command/input/results/warnings", encoded)
1328 }
1329}
1330
1331func TestUnsupportedCommandsReturnJSONErrorEnvelope(t *testing.T) {
1332 for _, name := range []string{"login", "completion"} {

Callers

nothing calls this directly

Calls 1

newJSONOperationOutputFunction · 0.85

Tested by

no test coverage detected