MCPcopy Create free account
hub / github.com/openclaw/gogcli / TestSlidesMoveSlideJSON

Function TestSlidesMoveSlideJSON

internal/cmd/slides_structural_test.go:376–409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

374}
375
376func TestSlidesMoveSlideJSON(t *testing.T) {
377 var captured []*slides.Request
378 srv := mockSlidesBatchUpdateServer(t, &captured, map[string]any{
379 "presentationId": "pres1",
380 "replies": []any{map[string]any{}},
381 })
382 defer srv.Close()
383
384 svc := newSlidesServiceFromServer(t, srv)
385 flags := &RootFlags{Account: "a@b.com"}
386 var out bytes.Buffer
387 ctx := withSlidesTestService(newCmdRuntimeJSONOutputContext(t, &out, io.Discard), svc)
388
389 cmd := &SlidesMoveSlideCmd{
390 PresentationID: "pres1",
391 SlideID: "slide_1",
392 ToIndex: int64TestPtr(2),
393 }
394 if err := cmd.Run(ctx, flags); err != nil {
395 t.Fatalf("Run: %v", err)
396 }
397
398 var got struct {
399 PresentationID string `json:"presentationId"`
400 SlideObjectID string `json:"slideObjectId"`
401 ToIndex int64 `json:"toIndex"`
402 }
403 if err := json.Unmarshal(out.Bytes(), &got); err != nil {
404 t.Fatalf("JSON parse: %v\noutput: %s", err, out.String())
405 }
406 if got.PresentationID != "pres1" || got.SlideObjectID != "slide_1" || got.ToIndex != 2 {
407 t.Fatalf("unexpected JSON output: %#v", got)
408 }
409}
410
411func TestSlidesMoveSlideDryRunSkipsService(t *testing.T) {
412 flags := &RootFlags{Account: "a@b.com", DryRun: true}

Callers

nothing calls this directly

Calls 8

RunMethod · 0.95
withSlidesTestServiceFunction · 0.85
int64TestPtrFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected