| 1894 | } |
| 1895 | |
| 1896 | func TestCreateSessionRequest_RequestElicitation(t *testing.T) { |
| 1897 | t.Run("sends requestElicitation flag when OnElicitationRequest is provided", func(t *testing.T) { |
| 1898 | req := createSessionRequest{ |
| 1899 | RequestElicitation: Bool(true), |
| 1900 | } |
| 1901 | data, err := json.Marshal(req) |
| 1902 | if err != nil { |
| 1903 | t.Fatalf("Failed to marshal: %v", err) |
| 1904 | } |
| 1905 | var m map[string]any |
| 1906 | if err := json.Unmarshal(data, &m); err != nil { |
| 1907 | t.Fatalf("Failed to unmarshal: %v", err) |
| 1908 | } |
| 1909 | if m["requestElicitation"] != true { |
| 1910 | t.Errorf("Expected requestElicitation to be true, got %v", m["requestElicitation"]) |
| 1911 | } |
| 1912 | }) |
| 1913 | |
| 1914 | t.Run("does not send requestElicitation when no handler provided", func(t *testing.T) { |
| 1915 | req := createSessionRequest{} |
| 1916 | data, _ := json.Marshal(req) |
| 1917 | var m map[string]any |
| 1918 | json.Unmarshal(data, &m) |
| 1919 | if _, ok := m["requestElicitation"]; ok { |
| 1920 | t.Error("Expected requestElicitation to be omitted when not set") |
| 1921 | } |
| 1922 | }) |
| 1923 | } |
| 1924 | |
| 1925 | func TestCreateSessionRequest_ModeCallbackFlags(t *testing.T) { |
| 1926 | t.Run("sends mode callback flags when handlers are provided", func(t *testing.T) { |