fix(ai): isolate provider test results between edits
This commit is contained in:
2 files changed
+17
No files matched your search
@@ -4677,6 +4677,8 @@ function aiSelectProvider(presetId: string) {
|
||||
if (isWeb && CLI_AI_PROVIDERS.has(provider)) return;
|
||||
if (presetId === aiEditProviderPresetId.value) return;
|
||||
|
||||
syncAiEditState();
|
||||
|
||||
// Apply new provider's preset defaults to edit state
|
||||
aiEditProviderPresetId.value = presetId;
|
||||
aiEditProvider.value = provider;
|
||||
@@ -4706,6 +4708,7 @@ function aiEnterListMode() {
|
||||
}
|
||||
|
||||
function aiEnterEditMode(configId?: string) {
|
||||
syncAiEditState();
|
||||
aiConfigListMode.value = "edit";
|
||||
aiEditConfigId.value = configId || null;
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const dialogSource = readFileSync(new URL("../EditorSettingsDialog.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("EditorSettingsDialog AI test result isolation", () => {
|
||||
it("clears the previous test result when opening another configuration", () => {
|
||||
expect(dialogSource).toMatch(/function aiEnterEditMode\(configId\?: string\) \{\s*syncAiEditState\(\);/);
|
||||
});
|
||||
|
||||
it("clears the previous test result when changing provider in the editor", () => {
|
||||
expect(dialogSource).toMatch(/if \(presetId === aiEditProviderPresetId\.value\) return;\s*\n\s*syncAiEditState\(\);/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user