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

Function TestSlidesInsertText

internal/cmd/slides_insert_text_test.go:111–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestSlidesInsertText(t *testing.T) {
112 var captured []*slides.Request
113 srv := mockSlidesBatchUpdateServer(t, &captured, map[string]any{
114 "presentationId": "pres1",
115 "replies": []any{map[string]any{}},
116 "writeControl": map[string]any{"requiredRevisionId": "rev-123"},
117 })
118 defer srv.Close()
119
120 svc := newSlidesServiceFromServer(t, srv)
121 flags := &RootFlags{Account: "a@b.com"}
122 var out bytes.Buffer
123 ctx := withSlidesTestService(newCmdRuntimeOutputContext(t, &out, io.Discard), svc)
124
125 cmd := &SlidesInsertTextCmd{
126 PresentationID: "pres1",
127 ObjectID: "shape_1",
128 Text: "hello world",
129 InsertionIndex: 3,
130 }
131 if err := cmd.Run(ctx, flags); err != nil && ExitCode(err) != 0 {
132 t.Fatalf("Run: %v", err)
133 }
134
135 if !strings.Contains(out.String(), "ok | revisionId=rev-123 | replies=1") {
136 t.Errorf("expected plain confirmation with revisionId and replies, got: %q", out.String())
137 }
138 if len(captured) != 1 {
139 t.Fatalf("expected 1 request in batch, got %d", len(captured))
140 }
141 if captured[0].InsertText == nil {
142 t.Fatal("expected InsertText request")
143 }
144 if captured[0].InsertText.Text != "hello world" {
145 t.Errorf("expected text %q, got %q", "hello world", captured[0].InsertText.Text)
146 }
147 if captured[0].InsertText.ObjectId != "shape_1" {
148 t.Errorf("expected objectId shape_1, got %q", captured[0].InsertText.ObjectId)
149 }
150 if captured[0].InsertText.InsertionIndex != 3 {
151 t.Errorf("expected insertionIndex 3, got %d", captured[0].InsertText.InsertionIndex)
152 }
153}
154
155func TestSlidesInsertText_ReplaceEmitsDeleteThenInsert(t *testing.T) {
156 var captured []*slides.Request

Callers

nothing calls this directly

Calls 9

RunMethod · 0.95
withSlidesTestServiceFunction · 0.85
ExitCodeFunction · 0.85
ErrorfMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected