MCPcopy Create free account
hub / github.com/github/copilot-sdk / TestSession_ElicitationRequestSchema

Function TestSession_ElicitationRequestSchema

go/session_test.go:1135–1217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1133}
1134
1135func TestSession_ElicitationRequestSchema(t *testing.T) {
1136 t.Run("nil content values are allowed", func(t *testing.T) {
1137 value, err := toRPCContent(nil)
1138 if err != nil {
1139 t.Fatalf("Expected nil content to be accepted, got %v", err)
1140 }
1141 if value != nil {
1142 t.Fatalf("Expected nil RPC content, got %T", value)
1143 }
1144 })
1145
1146 t.Run("elicitation.requested passes full schema to handler", func(t *testing.T) {
1147 // Verify the schema extraction logic from handleBroadcastEvent
1148 // preserves type, properties, and required.
1149 properties := map[string]any{
1150 "name": map[string]any{"type": "string"},
1151 "age": map[string]any{"type": "number"},
1152 }
1153 required := []string{"name", "age"}
1154
1155 requestedSchema := ElicitationSchema{
1156 Properties: properties,
1157 Required: required,
1158 }
1159
1160 props := requestedSchema.Properties
1161 if props == nil {
1162 t.Fatal("Expected schema properties map")
1163 }
1164 if len(props) != 2 {
1165 t.Errorf("Expected 2 properties, got %d", len(props))
1166 }
1167 if len(requestedSchema.Required) != 2 {
1168 t.Errorf("Expected required [name, age], got %v", requestedSchema.Required)
1169 }
1170 })
1171
1172 t.Run("schema without required omits required key", func(t *testing.T) {
1173 properties := map[string]any{
1174 "optional_field": map[string]any{"type": "string"},
1175 }
1176
1177 requestedSchema := ElicitationSchema{
1178 Properties: properties,
1179 }
1180
1181 if requestedSchema.Required != nil {
1182 t.Error("Expected Required to be nil when omitted")
1183 }
1184 })
1185
1186 t.Run("schema conversion adds object type", func(t *testing.T) {
1187 requestedSchema := ElicitationSchema{
1188 Properties: map[string]any{
1189 "name": map[string]any{"type": "string"},
1190 },
1191 }
1192

Callers

nothing calls this directly

Calls 3

toRPCContentFunction · 0.85
toRPCUIElicitationSchemaFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…