MCPcopy Index your code
hub / github.com/coder/coder / TestHandleAction_HoldKeyMissingText

Function TestHandleAction_HoldKeyMissingText

agent/x/agentdesktop/api_test.go:629–656  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

627}
628
629func TestHandleAction_HoldKeyMissingText(t *testing.T) {
630 t.Parallel()
631
632 logger := slogtest.Make(t, nil)
633 fake := &fakeDesktop{
634 startCfg: agentdesktop.DisplayConfig{Width: 1920, Height: 1080},
635 }
636 api := agentdesktop.NewAPI(logger, fake, nil)
637 defer api.Close()
638
639 body := agentdesktop.DesktopAction{Action: "hold_key"}
640 b, err := json.Marshal(body)
641 require.NoError(t, err)
642
643 rr := httptest.NewRecorder()
644 req := httptest.NewRequest(http.MethodPost, "/action", bytes.NewReader(b))
645 req.Header.Set("Content-Type", "application/json")
646
647 handler := api.Routes()
648 handler.ServeHTTP(rr, req)
649
650 assert.Equal(t, http.StatusBadRequest, rr.Code)
651
652 var resp codersdk.Response
653 err = json.NewDecoder(rr.Body).Decode(&resp)
654 require.NoError(t, err)
655 assert.Equal(t, "Missing \"text\" for hold_key action.", resp.Message)
656}
657
658func TestHandleAction_ScrollDown(t *testing.T) {
659 t.Parallel()

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
RoutesMethod · 0.95
NewAPIFunction · 0.92
SetMethod · 0.65
MarshalMethod · 0.45
ServeHTTPMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected