Files
Netcatty/components/settings/tabs/ai/CopilotCliCard.test.tsx
T
陈大猫 3408bba303 [codex] Add Cursor SDK agent support (#1399)
* feat(ai): add Cursor SDK agent support

* fix(ai): harden Cursor SDK support

* fix(ai): address Cursor SDK review findings

* fix(ai): refresh Cursor environment handling

* fix(ai): refresh Cursor discovery scans

* fix(ai): enable Cursor recheck without path

* Use official Cursor agent icon

* Clarify Cursor SDK setup requirements

* Split Cursor SDK setup status

* Simplify Cursor settings copy

* Improve Cursor API key error

* Add safe Cursor auth diagnostics

* Disable Cursor local sandbox by default

* Show Cursor MCP tool names in tool cards

* Add spacing inside tool call groups
2026-06-11 16:43:34 +08:00

41 lines
1.2 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { CopilotCliCard } from "./CopilotCliCard";
function firstButton(markup: string): string {
const match = markup.match(/<button\b[^>]*>/);
return match?.[0] ?? "";
}
test("Cursor check button stays enabled without a custom path", () => {
const markup = renderToStaticMarkup(
<CopilotCliCard
pathInfo={{ path: null, version: null, available: false }}
isResolvingPath={false}
customPath=""
onCustomPathChange={() => {}}
onRecheckPath={() => {}}
i18nPrefix="ai.cursor"
allowEmptyCheck
/>,
);
assert.equal(firstButton(markup).includes("disabled=\"\""), false);
});
test("Copilot check button still requires a custom path", () => {
const markup = renderToStaticMarkup(
<CopilotCliCard
pathInfo={{ path: null, version: null, available: false }}
isResolvingPath={false}
customPath=""
onCustomPathChange={() => {}}
onRecheckPath={() => {}}
/>,
);
assert.equal(firstButton(markup).includes("disabled=\"\""), true);
});