Skip to content

Commit e2502f9

Browse files
committed
Removed old filebased ghostprovider tests
Instead we either want full tests using the llm in the evals, or unit tests on ghoststreaming parser. These just have the wrong abstraction level
1 parent 84df622 commit e2502f9

File tree

31 files changed

+0
-515
lines changed

31 files changed

+0
-515
lines changed

src/services/ghost/__tests__/GhostProvider.spec.ts

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { describe, it, expect, beforeEach, vi } from "vitest"
2-
import * as fs from "node:fs"
3-
import * as path from "node:path"
42
import { MockWorkspace } from "./MockWorkspace"
53
import * as vscode from "vscode"
64
import { GhostStreamingParser } from "../GhostStreamingParser"
@@ -123,107 +121,6 @@ describe("GhostProvider", () => {
123121
return { testUri, context, mockDocument }
124122
}
125123

126-
// Test cases directory for file-based tests
127-
const TEST_CASES_DIR = path.join(__dirname, "__test_cases__")
128-
129-
// Helper function to run file-based tests
130-
async function runFileBasedTest(testCaseName: string) {
131-
const testCasePath = path.join(TEST_CASES_DIR, testCaseName)
132-
const inputFilePath = path.join(testCasePath, "input.js")
133-
const diffFilePath = path.join(testCasePath, "response.txt")
134-
const expectedFilePath = path.join(testCasePath, "expected.js")
135-
136-
const initialContent = fs.readFileSync(inputFilePath, "utf8")
137-
// Read the response file
138-
const response = fs.readFileSync(diffFilePath, "utf8")
139-
const expectedContent = fs.readFileSync(expectedFilePath, "utf8")
140-
141-
const { testUri, context, mockDocument } = await setupTestDocument(`${testCaseName}/input.js`, initialContent)
142-
143-
// Parse and apply suggestions
144-
streamingParser.initialize(context)
145-
const parseResult = streamingParser.parseResponse(response, "", "")
146-
147-
// Apply the changes if we have suggestions
148-
if (parseResult.hasNewSuggestions) {
149-
const fillInSuggestion = parseResult.suggestions.getFillInAtCursor()
150-
if (fillInSuggestion) {
151-
// For FIM (Fill-In-Middle) suggestions, reconstruct the full content
152-
const newContent = fillInSuggestion.prefix + fillInSuggestion.text + fillInSuggestion.suffix
153-
;(mockDocument as any).updateContent(newContent)
154-
}
155-
}
156-
157-
const finalContent = mockWorkspace.getDocumentContent(testUri)
158-
// Compare the normalized content
159-
const normalizedFinal = normalizeWhitespace(finalContent)
160-
const normalizedExpected = normalizeWhitespace(expectedContent)
161-
162-
// For certain tests, we need special handling due to formatting differences
163-
if (testCaseName === "complex-multi-group") {
164-
// For complex-multi-group, normalize the function and comment order
165-
const normalizedForComparison = (content: string) => {
166-
// Remove all whitespace and normalize function declarations with comments
167-
return content.replace(/\/\/\s*([^\n]+)\s*([a-zA-Z]+\([^)]*\))\s*{/g, "$2 { // $1").replace(/\s+/g, "")
168-
}
169-
170-
const processedFinal = normalizedForComparison(normalizedFinal)
171-
const processedExpected = normalizedForComparison(normalizedExpected)
172-
expect(processedFinal).toBe(processedExpected)
173-
} else if (testCaseName === "partial-mixed-operations") {
174-
// For partial-mixed-operations, compare without whitespace
175-
const strippedFinal = normalizedFinal.replace(/\s+/g, "")
176-
const strippedExpected = normalizedExpected.replace(/\s+/g, "")
177-
expect(strippedFinal).toBe(strippedExpected)
178-
} else {
179-
expect(normalizedFinal).toBe(normalizedExpected)
180-
}
181-
}
182-
183-
describe("File-based Suggestions", () => {
184-
it("should apply a simple addition from files", async () => {
185-
await runFileBasedTest("simple-addition")
186-
})
187-
188-
it("should apply multiple line additions from files", async () => {
189-
await runFileBasedTest("multiple-line-additions")
190-
})
191-
192-
it("should apply line deletions from files", async () => {
193-
await runFileBasedTest("line-deletions")
194-
})
195-
196-
it("should apply mixed addition and deletion from files", async () => {
197-
await runFileBasedTest("mixed-addition-deletion")
198-
})
199-
200-
it("should handle empty diff response from files", async () => {
201-
await runFileBasedTest("empty-diff-response")
202-
})
203-
204-
it("should apply function rename and var to const changes from files", async () => {
205-
await runFileBasedTest("function-rename-var-to-const")
206-
})
207-
})
208-
209-
describe("Sequential application", () => {
210-
it("should handle an inverse individual application of mixed operations", async () => {
211-
await runFileBasedTest("sequential-mixed-operations")
212-
})
213-
214-
it("should handle sequential partial application of mixed operations", async () => {
215-
await runFileBasedTest("partial-mixed-operations")
216-
})
217-
218-
it("should handle random individual application of mixed operations", async () => {
219-
await runFileBasedTest("random-mixed-operations")
220-
})
221-
222-
it("should handle complex multi-group operations", async () => {
223-
await runFileBasedTest("complex-multi-group")
224-
})
225-
})
226-
227124
describe("Error Handling", () => {
228125
it("should handle empty diff responses", async () => {
229126
const initialContent = `console.log('test');`

src/services/ghost/__tests__/__test_cases__/complex-multi-group/expected.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/complex-multi-group/input.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/complex-multi-group/response.txt

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/empty-diff-response/expected.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/services/ghost/__tests__/__test_cases__/empty-diff-response/input.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/services/ghost/__tests__/__test_cases__/empty-diff-response/response.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/function-rename-var-to-const/expected.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/function-rename-var-to-const/input.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/services/ghost/__tests__/__test_cases__/function-rename-var-to-const/response.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)