MCPcopy Index your code
hub / github.com/github/copilot-sdk / TestSessionRequests_Capi

Function TestSessionRequests_Capi

go/client_test.go:1774–1827  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1772}
1773
1774func TestSessionRequests_Capi(t *testing.T) {
1775 t.Run("forwards capi options in session.create RPC", func(t *testing.T) {
1776 req := createSessionRequest{
1777 Capi: &CapiSessionOptions{EnableWebSocketResponses: Bool(false)},
1778 }
1779 data, err := json.Marshal(req)
1780 if err != nil {
1781 t.Fatalf("Failed to marshal: %v", err)
1782 }
1783 var m map[string]any
1784 if err := json.Unmarshal(data, &m); err != nil {
1785 t.Fatalf("Failed to unmarshal: %v", err)
1786 }
1787 capi, ok := m["capi"].(map[string]any)
1788 if !ok {
1789 t.Fatalf("Expected capi to be an object, got %T", m["capi"])
1790 }
1791 if capi["enableWebSocketResponses"] != false {
1792 t.Errorf("Expected enableWebSocketResponses=false, got %v", capi["enableWebSocketResponses"])
1793 }
1794 })
1795
1796 t.Run("forwards capi options in session.resume RPC", func(t *testing.T) {
1797 req := resumeSessionRequest{
1798 SessionID: "s1",
1799 Capi: &CapiSessionOptions{EnableWebSocketResponses: Bool(false)},
1800 }
1801 data, err := json.Marshal(req)
1802 if err != nil {
1803 t.Fatalf("Failed to marshal: %v", err)
1804 }
1805 var m map[string]any
1806 if err := json.Unmarshal(data, &m); err != nil {
1807 t.Fatalf("Failed to unmarshal: %v", err)
1808 }
1809 capi, ok := m["capi"].(map[string]any)
1810 if !ok {
1811 t.Fatalf("Expected capi to be an object, got %T", m["capi"])
1812 }
1813 if capi["enableWebSocketResponses"] != false {
1814 t.Errorf("Expected enableWebSocketResponses=false, got %v", capi["enableWebSocketResponses"])
1815 }
1816 })
1817
1818 t.Run("omits capi from JSON when unset", func(t *testing.T) {
1819 req := createSessionRequest{}
1820 data, _ := json.Marshal(req)
1821 var m map[string]any
1822 json.Unmarshal(data, &m)
1823 if _, ok := m["capi"]; ok {
1824 t.Error("Expected capi to be omitted when unset")
1825 }
1826 })
1827}
1828
1829func TestProviderConfig_Transport(t *testing.T) {
1830 t.Run("serializes transport with camelCase key", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

BoolFunction · 0.85
MarshalMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…