Skip to content

Commit b91f69c

Browse files
Fix ESLint error, update .NET test to verify model_change event, add skipped Go test
Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
1 parent 6936cce commit b91f69c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

dotnet/test/SessionTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,13 @@ public async Task Should_Set_Model_On_Existing_Session()
447447
{
448448
var session = await CreateSessionAsync();
449449

450-
// SetModel should not throw
450+
// Subscribe for the model change event before calling SetModelAsync
451+
var modelChangedTask = TestHelper.GetNextEventOfTypeAsync<SessionModelChangeEvent>(session);
452+
451453
await session.SetModelAsync("gpt-4.1");
452454

453-
// Session should still be usable after model change
454-
await session.SendAsync(new MessageOptions { Prompt = "What is 1+1?" });
455-
var assistantMessage = await TestHelper.GetFinalAssistantMessageAsync(session);
456-
Assert.NotNull(assistantMessage);
455+
// Verify a model_change event was emitted with the new model
456+
var modelChanged = await modelChangedTask;
457+
Assert.Equal("gpt-4.1", modelChanged.Data.NewModel);
457458
}
458459
}

go/internal/e2e/rpc_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,23 @@ func TestSessionRpc(t *testing.T) {
189189
}
190190
})
191191

192+
// session.model.switchTo is defined in schema but not yet implemented in CLI
193+
t.Run("should call session.SetModel", func(t *testing.T) {
194+
t.Skip("session.model.switchTo not yet implemented in CLI")
195+
196+
session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
197+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
198+
Model: "claude-sonnet-4.5",
199+
})
200+
if err != nil {
201+
t.Fatalf("Failed to create session: %v", err)
202+
}
203+
204+
if err := session.SetModel(t.Context(), "gpt-4.1"); err != nil {
205+
t.Fatalf("SetModel returned error: %v", err)
206+
}
207+
})
208+
192209
t.Run("should get and set session mode", func(t *testing.T) {
193210
session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{OnPermissionRequest: copilot.PermissionHandler.ApproveAll})
194211
if err != nil {

nodejs/test/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("CopilotClient", () => {
8989

9090
// Mock sendRequest to capture the call without hitting the runtime
9191
const spy = vi.spyOn((client as any).connection!, "sendRequest")
92-
.mockImplementation(async (method: string, params: any) => {
92+
.mockImplementation(async (method: string, _params: any) => {
9393
if (method === "session.model.switchTo") return {};
9494
// Fall through for other methods (shouldn't be called)
9595
throw new Error(`Unexpected method: ${method}`);

0 commit comments

Comments
 (0)