Skip to content

Commit 432ddad

Browse files
hannesrudolphdaniel-lxs
authored andcommitted
test: update service-factory tests for new error messages
1 parent 4277572 commit 432ddad

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/services/code-index/__tests__/service-factory.spec.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ describe("CodeIndexServiceFactory", () => {
146146
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
147147

148148
// Act & Assert
149-
expect(() => factory.createEmbedder()).toThrow("OpenAI configuration missing for embedder creation")
149+
expect(() => factory.createEmbedder()).toThrow(
150+
"OpenAI API key is required. Please configure it in the settings.",
151+
)
150152
})
151153

152154
it("should throw error when Ollama base URL is missing", () => {
@@ -161,7 +163,9 @@ describe("CodeIndexServiceFactory", () => {
161163
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
162164

163165
// Act & Assert
164-
expect(() => factory.createEmbedder()).toThrow("Ollama configuration missing for embedder creation")
166+
expect(() => factory.createEmbedder()).toThrow(
167+
"Ollama base URL is required. Please configure it in the settings.",
168+
)
165169
})
166170

167171
it("should pass model ID to OpenAI Compatible embedder when using OpenAI Compatible provider", () => {
@@ -225,7 +229,7 @@ describe("CodeIndexServiceFactory", () => {
225229

226230
// Act & Assert
227231
expect(() => factory.createEmbedder()).toThrow(
228-
"OpenAI Compatible configuration missing for embedder creation",
232+
"OpenAI-compatible base URL required. Please configure in the settings.",
229233
)
230234
})
231235

@@ -243,7 +247,7 @@ describe("CodeIndexServiceFactory", () => {
243247

244248
// Act & Assert
245249
expect(() => factory.createEmbedder()).toThrow(
246-
"OpenAI Compatible configuration missing for embedder creation",
250+
"OpenAI-compatible API key required. Please configure in the settings.",
247251
)
248252
})
249253

@@ -258,7 +262,7 @@ describe("CodeIndexServiceFactory", () => {
258262

259263
// Act & Assert
260264
expect(() => factory.createEmbedder()).toThrow(
261-
"OpenAI Compatible configuration missing for embedder creation",
265+
"OpenAI-compatible base URL and API key required. Please configure in the settings.",
262266
)
263267
})
264268

0 commit comments

Comments
 (0)