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

Function TestSlidesMoveSlide

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

Source from the content-addressed store, hash-verified

337}
338
339func TestSlidesMoveSlide(t *testing.T) {
340 var captured []*slides.Request
341 srv := mockSlidesBatchUpdateServer(t, &captured, map[string]any{
342 "presentationId": "pres1",
343 "replies": []any{map[string]any{}},
344 })
345 defer srv.Close()
346
347 svc := newSlidesServiceFromServer(t, srv)
348 flags := &RootFlags{Account: "a@b.com"}
349 var out bytes.Buffer
350 ctx := withSlidesTestService(newCmdRuntimeOutputContext(t, &out, io.Discard), svc)
351
352 cmd := &SlidesMoveSlideCmd{
353 PresentationID: "pres1",
354 SlideID: "slide_1",
355 ToIndex: int64TestPtr(3),
356 }
357 if err := cmd.Run(ctx, flags); err != nil {
358 t.Fatalf("Run: %v", err)
359 }
360
361 if len(captured) != 1 {
362 t.Fatalf("expected 1 request, got %d", len(captured))
363 }
364 move := captured[0].UpdateSlidesPosition
365 if move == nil {
366 t.Fatalf("expected UpdateSlidesPosition request, got %+v", captured[0])
367 }
368 if len(move.SlideObjectIds) != 1 || move.SlideObjectIds[0] != "slide_1" || move.InsertionIndex != 3 {
369 t.Fatalf("unexpected move request: %+v", move)
370 }
371 if got := out.String(); !strings.Contains(got, "slideObjectId\tslide_1") || !strings.Contains(got, "toIndex\t3") {
372 t.Fatalf("unexpected stdout: %q", got)
373 }
374}
375
376func TestSlidesMoveSlideJSON(t *testing.T) {
377 var captured []*slides.Request

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