mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
feat: 完成测试 16-17
This commit is contained in:
37
src/tools/LSPTool/__tests__/schemas.test.ts
Normal file
37
src/tools/LSPTool/__tests__/schemas.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { isValidLSPOperation } from "../schemas";
|
||||
|
||||
describe("isValidLSPOperation", () => {
|
||||
const validOps = [
|
||||
"goToDefinition",
|
||||
"findReferences",
|
||||
"hover",
|
||||
"documentSymbol",
|
||||
"workspaceSymbol",
|
||||
"goToImplementation",
|
||||
"prepareCallHierarchy",
|
||||
"incomingCalls",
|
||||
"outgoingCalls",
|
||||
];
|
||||
|
||||
test.each(validOps)("returns true for valid operation: %s", (op) => {
|
||||
expect(isValidLSPOperation(op)).toBe(true);
|
||||
});
|
||||
|
||||
test("returns false for invalid operation", () => {
|
||||
expect(isValidLSPOperation("invalidOp")).toBe(false);
|
||||
});
|
||||
|
||||
test("returns false for empty string", () => {
|
||||
expect(isValidLSPOperation("")).toBe(false);
|
||||
});
|
||||
|
||||
test("returns false for undefined", () => {
|
||||
expect(isValidLSPOperation(undefined as any)).toBe(false);
|
||||
});
|
||||
|
||||
test("is case sensitive", () => {
|
||||
expect(isValidLSPOperation("GoToDefinition")).toBe(false);
|
||||
expect(isValidLSPOperation("HOVER")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user