fix: isolate concurrent OpenCode chat runs
This commit is contained in:
@@ -217,7 +217,51 @@ describe('useProviderStore importUserModelConfig()', () => {
|
||||
expect(result.importedModels).toEqual(['gpt-4.1-mini', 'gpt-4o-mini']);
|
||||
expect(mockHostApiFetch).toHaveBeenCalledWith('/api/provider-accounts/import-user-model-config', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ accessToken: 'access-token' }),
|
||||
body: JSON.stringify({
|
||||
accessToken: 'access-token',
|
||||
runtimeRefresh: 'apply',
|
||||
}),
|
||||
});
|
||||
expect(mockFetchProviderSnapshot).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('defers runtime refresh when requested and exposes whether a manual restart is required', async () => {
|
||||
const account = {
|
||||
id: 'niancode-user-models',
|
||||
vendorId: 'custom',
|
||||
label: 'Makelore Models',
|
||||
authMode: 'api_key',
|
||||
model: 'gpt-4.1-mini',
|
||||
enabled: true,
|
||||
isDefault: true,
|
||||
createdAt: '2026-06-19T00:00:00.000Z',
|
||||
updatedAt: '2026-06-19T00:00:00.000Z',
|
||||
} as const;
|
||||
mockHostApiFetch.mockResolvedValueOnce({
|
||||
success: true,
|
||||
account,
|
||||
importedModels: ['gpt-4.1-mini'],
|
||||
runtimeRefreshRequired: true,
|
||||
});
|
||||
mockFetchProviderSnapshot.mockResolvedValueOnce({
|
||||
statuses: [],
|
||||
accounts: [account],
|
||||
vendors: [],
|
||||
defaultAccountId: account.id,
|
||||
});
|
||||
|
||||
const result = await useProviderStore.getState().importUserModelConfig(
|
||||
'access-token',
|
||||
{ runtimeRefresh: 'defer' },
|
||||
);
|
||||
|
||||
expect(result.runtimeRefreshRequired).toBe(true);
|
||||
expect(mockHostApiFetch).toHaveBeenCalledWith('/api/provider-accounts/import-user-model-config', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
accessToken: 'access-token',
|
||||
runtimeRefresh: 'defer',
|
||||
}),
|
||||
});
|
||||
expect(mockFetchProviderSnapshot).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user