Files
Netcatty/electron/bridges/aiBridge/agentDiscoveryHandlers.test.cjs
T
bincxz 1f97044199 fix(ai): keep Cursor CLI path when status probe fails
A resolved cursor-agent binary is a user install even when status JSON
is missing, unrecognized, or the status command throws. Login still
requires parsed authenticated status output.
2026-08-27 21:10:49 +08:00

46 lines
1.4 KiB
JavaScript

"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const { computeCursorInstallState } = require("./agentDiscoveryHandlers.cjs");
test("computeCursorInstallState: bundled SDK is not a user Cursor install", () => {
const state = computeCursorInstallState({
sdkInstalled: true,
cliBinPath: null,
cliLoginOk: false,
});
assert.equal(state.sdkInstalled, true);
assert.equal(state.installed, false);
});
test("computeCursorInstallState: Agent CLI on PATH is a user Cursor install", () => {
const state = computeCursorInstallState({
sdkInstalled: true,
cliBinPath: "/usr/local/bin/cursor-agent",
cliLoginOk: false,
});
assert.equal(state.sdkInstalled, true);
assert.equal(state.installed, true);
});
test("computeCursorInstallState: logged-out CLI path is installed without cliLoginOk", () => {
const state = computeCursorInstallState({
sdkInstalled: true,
cliBinPath: "/bin/cursor-agent",
cliLoginOk: false,
});
assert.equal(state.installed, true);
assert.equal(state.sdkInstalled, true);
});
test("computeCursorInstallState: proven CLI login is a user Cursor install", () => {
const state = computeCursorInstallState({
sdkInstalled: false,
cliBinPath: null,
cliLoginOk: true,
});
assert.equal(state.sdkInstalled, false);
assert.equal(state.installed, true);
});