Skip to content

Commit 13752b1

Browse files
committed
fix: update test assertions to match generalized model fetch naming
1 parent 44ea481 commit 13752b1

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

src/routes/settings/SettingsAiLayout.test.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,50 @@ test('日报导出目录应从 AI 设置移到存储设置', async () => {
3838
assert.match(storageSource, /settingsStorage\.modeAllDesc/);
3939
});
4040

41-
test('Ollama 提供商应支持获取模型列表并保留手动输入回退', async () => {
41+
test('所有提供商应支持获取模型列表并保留手动输入回退', async () => {
4242
const source = await readFile(
4343
new URL('./components/SettingsAI.svelte', import.meta.url),
4444
'utf8'
4545
);
4646

47-
assert.match(source, /invoke\('get_ollama_models'/);
48-
assert.match(source, /refreshOllamaModels/);
49-
assert.match(source, /ollamaModels/);
50-
assert.match(source, /provider === 'ollama'/);
47+
assert.match(source, /invoke\('fetch_models'/);
48+
assert.match(source, /refreshModels/);
49+
assert.match(source, /fetchedModels/);
5150
assert.match(source, /<select/);
5251
assert.match(source, /settingsAI\.manualModel/);
5352
assert.match(source, /settingsAI\.refreshModels/);
5453
});
5554

56-
test('Ollama 刷新模型列表后应给出反馈并在当前模型失效时自动回填可用模型', async () => {
55+
test('刷新模型列表后应给出反馈并在当前模型失效时自动回填可用模型', async () => {
5756
const source = await readFile(
5857
new URL('./components/SettingsAI.svelte', import.meta.url),
5958
'utf8'
6059
);
6160

62-
assert.match(source, /!ollamaModels.includes\(config\.text_model\.model\)/);
61+
assert.match(source, /!fetchedModels\.includes\(config\.text_model\.model\)/);
6362
assert.match(source, /settingsAI\.loadedModels/);
6463
});
6564

66-
test('Ollama 模型列表为空时应保留当前模型值,避免下拉框显示空白', async () => {
65+
test('模型列表为空时应保留当前模型值,避免下拉框显示空白', async () => {
6766
const source = await readFile(
6867
new URL('./components/SettingsAI.svelte', import.meta.url),
6968
'utf8'
7069
);
7170

72-
assert.match(source, /let selectedOllamaModel = '';/);
73-
assert.match(source, /function getOllamaFallbackOptionLabel\(\)/);
71+
assert.match(source, /let selectedModel = '';/);
72+
assert.match(source, /function getModelFallbackOptionLabel\(\)/);
7473
assert.match(source, /settingsAI\.currentModelLoading/);
7574
assert.match(source, /settingsAI\.currentModelMissing/);
76-
assert.match(source, /\{getOllamaFallbackOptionLabel\(\)\}/);
75+
assert.match(source, /\{getModelFallbackOptionLabel\(\)\}/);
7776
});
7877

79-
test('Ollama 下拉列表应只展示实际返回的模型,并明确区分手动输入值', async () => {
78+
test('下拉列表应只展示实际返回的模型,并明确区分手动输入值', async () => {
8079
const source = await readFile(
8180
new URL('./components/SettingsAI.svelte', import.meta.url),
8281
'utf8'
8382
);
8483

85-
assert.doesNotMatch(source, /return \[config\.text_model\.model, \.\.\.ollamaModels\];/);
84+
assert.doesNotMatch(source, /return \[config\.text_model\.model, \.\.\.fetchedModels\];/);
8685
assert.match(source, /settingsAI\.manualModelMissing/);
87-
assert.match(source, /#each ollamaModels as model \(model\)/);
86+
assert.match(source, /#each fetchedModels as model \(model\)/);
8887
});

0 commit comments

Comments
 (0)