Skip to content

Commit 2d04b98

Browse files
committed
test(onboard): narrow Ollama version mock
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
1 parent 2b5a013 commit 2d04b98

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/lib/onboard/ollama-install-menu.test.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,25 @@ function captureOllamaVersions(
1515
daemonVersion: string | null,
1616
binaryVersion: string | null,
1717
): (command: readonly string[]) => string {
18-
const responses = new Map([
19-
["curl", daemonVersion ? JSON.stringify({ version: daemonVersion }) : ""],
20-
["ollama", binaryVersion ? `ollama version is ${binaryVersion}` : ""],
18+
const responses = new Map<string, string>([
19+
[
20+
JSON.stringify([
21+
"curl",
22+
"-sf",
23+
"--connect-timeout",
24+
"2",
25+
"--max-time",
26+
"5",
27+
"http://127.0.0.1:11434/api/version",
28+
]),
29+
daemonVersion ? JSON.stringify({ version: daemonVersion }) : "",
30+
],
31+
[
32+
JSON.stringify(["ollama", "--version"]),
33+
binaryVersion ? `ollama version is ${binaryVersion}` : "",
34+
],
2135
]);
22-
return (command) => responses.get(command[0] ?? "") ?? "";
36+
return (command) => responses.get(JSON.stringify(command)) ?? "";
2337
}
2438

2539
describe("resolveRunningOllamaMenuEntry", () => {

0 commit comments

Comments
 (0)