Elffuss BraidHub

kikocis/continue public

3297e898700c · 1.5 KiBRawPermalink
1import { describe, test } from "vitest";
2import { PYTHON_TEST_CASES, TYPESCRIPT_TEST_CASES } from "./testCases";
3import { testRootPathContext } from "./testUtils";
4
5const TEST_CASES = [
6 ...PYTHON_TEST_CASES,
7 ...TYPESCRIPT_TEST_CASES,
8 {
9 nodeType: "function_definition",
10 fileName: "file1.php",
11 language: "PHP",
12 cursorPosition: { line: 12, character: 32 },
13 definitionPositions: [
14 { row: 10, column: 26 }, // Person
15 { row: 10, column: 44 }, // Address
16 ],
17 },
18 {
19 nodeType: "method_declaration",
20 fileName: "file1.php",
21 language: "PHP",
22 cursorPosition: { line: 26, character: 35 },
23 definitionPositions: [
24 { row: 15, column: 29 }, // BaseClass
25 { row: 15, column: 55 }, // FirstInterface
26 { row: 15, column: 72 }, // SecondInterface
27 { row: 25, column: 43 }, // Person
28 { row: 25, column: 61 }, // Address
29 ],
30 },
31 {
32 nodeType: "function_declaration",
33 fileName: "file1.go",
34 language: "Go",
35 cursorPosition: { line: 7, character: 21 },
36 definitionPositions: [
37 { row: 6, column: 33 }, // models.User
38 { row: 6, column: 50 }, // models.Address
39 ],
40 },
41];
42
43describe("RootPathContextService", () => {
44 describe("should look for correct type definitions", () => {
45 test.each(TEST_CASES)(
46 "$language: $nodeType",
47 async ({ fileName, cursorPosition, definitionPositions }) => {
48 await testRootPathContext(
49 "files",
50 fileName,
51 cursorPosition,
52 definitionPositions,
53 );
54 },
55 );
56 });
57});