fix(opencode): switch session models without restart
This commit is contained in:
1 parent
1c6b004436
commit
c0163bc507
18 files changed
+718
-92
No files matched your search
@@ -50,6 +50,7 @@ function renderCommandHook(
|
||||
const actions = {
|
||||
rename: vi.fn<ChatCommandActions['rename']>().mockResolvedValue(undefined),
|
||||
timeline: vi.fn<ChatCommandActions['timeline']>(),
|
||||
models: vi.fn<ChatCommandActions['models']>(),
|
||||
compact: vi.fn<ChatCommandActions['compact']>().mockResolvedValue(undefined),
|
||||
share: vi.fn<ChatCommandActions['share']>().mockImplementation(async () => {
|
||||
context.shared = true;
|
||||
@@ -138,6 +139,17 @@ function renderCommandHook(
|
||||
}
|
||||
|
||||
describe('useChatCommands', () => {
|
||||
it('opens the shared model selector for both /models and /model', async () => {
|
||||
const fixture = renderCommandHook('/models');
|
||||
|
||||
await act(async () => fixture.result.current.tryExecuteDraft());
|
||||
expect(fixture.actions.models).toHaveBeenCalledOnce();
|
||||
expect(fixture.getDraft()).toBe('');
|
||||
|
||||
await fixture.run('/model');
|
||||
expect(fixture.actions.models).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('fills a palette selection and executes it only on the next Enter', async () => {
|
||||
const fixture = renderCommandHook('/comp');
|
||||
act(() => fixture.result.current.handleKeyDown(keyEvent('Enter')));
|
||||
|
||||
Reference in new issue
Block a user