Skip to content

Commit 8fba601

Browse files
committed
Fixed ghost tests for recent operations and service manager
1 parent 7f5b6c3 commit 8fba601

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ describe("GhostRecentOperations", () => {
124124
const { userPrompt } = autoTriggerStrategy.getPrompts(autocompleteInput, prefix, suffix, languageId)
125125

126126
// Verify that the prompt includes the recent operations section
127-
// The new strategy system uses "## Recent Typing" format
128-
expect(userPrompt).toContain("## Recent Typing")
127+
// The strategy system uses "<RECENT_EDITS>" XML format
128+
expect(userPrompt).toContain("<RECENT_EDITS>")
129129
})
130130

131131
it("should not include recent operations in the prompt when not available", async () => {

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ describe("GhostServiceManager", () => {
111111
expect(result.suggestions.hasSuggestions()).toBe(false)
112112
})
113113

114-
it("should handle invalid XML format", async () => {
114+
it("should handle invalid COMPLETION format", async () => {
115115
const initialContent = `console.log('test');`
116116
const { context } = await setupTestDocument("invalid.js", initialContent)
117117

118-
// Test invalid XML format
119-
const invalidXML = "This is not a valid XML format"
118+
const invalidCOMPLETION = "This is not a valid COMPLETION format"
120119
const position = context.range?.start ?? context.document.positionAt(0)
121120
const { prefix, suffix } = extractPrefixSuffix(context.document, position)
122-
const result = parseGhostResponse(invalidXML, prefix, suffix)
121+
const result = parseGhostResponse(invalidCOMPLETION, prefix, suffix)
123122
expect(result.suggestions.hasSuggestions()).toBe(false)
124123
})
125124

@@ -133,14 +132,12 @@ describe("GhostServiceManager", () => {
133132
openFiles: [],
134133
}
135134

136-
// Use XML format
137-
const xmlResponse = `<change><search><![CDATA[console.log('test');]]></search><replace><![CDATA[// Added comment
138-
console.log('test');]]></replace></change>`
135+
const completionResponse = `<COMPLETION>// Added comment
136+
console.log('test');</COMPLETION>`
139137

140138
const position = context.range?.start ?? context.document.positionAt(0)
141139
const { prefix, suffix } = extractPrefixSuffix(context.document, position)
142-
const result = parseGhostResponse(xmlResponse, prefix, suffix)
143-
// Should work with the XML format
140+
const result = parseGhostResponse(completionResponse, prefix, suffix)
144141
expect(result.suggestions.hasSuggestions()).toBe(true)
145142
})
146143
})

0 commit comments

Comments
 (0)