mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-25 03:34:22 +01:00
core: remove redundant patch integration test
The integration test was duplicating coverage already provided by the comprehensive patch namespace tests. Users benefit from faster test runs without losing any coverage of patch functionality. The remaining tests provide complete validation of patch parsing, application, and tool integration.
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
import { describe, test, expect } from "bun:test"
|
||||
import { Patch } from "../../src/patch"
|
||||
|
||||
describe("Patch integration", () => {
|
||||
test("should be compatible with existing tool system", () => {
|
||||
// Test that our Patch namespace can be imported and used
|
||||
expect(Patch).toBeDefined()
|
||||
expect(Patch.parsePatch).toBeDefined()
|
||||
expect(Patch.applyPatch).toBeDefined()
|
||||
expect(Patch.maybeParseApplyPatch).toBeDefined()
|
||||
expect(Patch.PatchSchema).toBeDefined()
|
||||
})
|
||||
|
||||
test("should parse patch format compatible with existing tool", () => {
|
||||
const patchText = `*** Begin Patch
|
||||
*** Add File: test-integration.txt
|
||||
+Integration test content
|
||||
*** End Patch`
|
||||
|
||||
const result = Patch.parsePatch(patchText)
|
||||
expect(result.hunks).toHaveLength(1)
|
||||
expect(result.hunks[0].type).toBe("add")
|
||||
expect(result.hunks[0].path).toBe("test-integration.txt")
|
||||
if (result.hunks[0].type === "add") {
|
||||
expect(result.hunks[0].contents).toBe("Integration test content")
|
||||
}
|
||||
})
|
||||
|
||||
test("should handle complex patch with multiple operations", () => {
|
||||
const patchText = `*** Begin Patch
|
||||
*** Add File: new-file.txt
|
||||
+This is a new file
|
||||
+with multiple lines
|
||||
*** Update File: existing.txt
|
||||
@@
|
||||
old content
|
||||
-line to remove
|
||||
+line to add
|
||||
more content
|
||||
*** Delete File: old-file.txt
|
||||
*** End Patch`
|
||||
|
||||
const result = Patch.parsePatch(patchText)
|
||||
expect(result.hunks).toHaveLength(3)
|
||||
|
||||
// Check add operation
|
||||
expect(result.hunks[0].type).toBe("add")
|
||||
if (result.hunks[0].type === "add") {
|
||||
expect(result.hunks[0].contents).toBe("This is a new file\nwith multiple lines")
|
||||
}
|
||||
|
||||
// Check update operation
|
||||
expect(result.hunks[1].type).toBe("update")
|
||||
if (result.hunks[1].type === "update") {
|
||||
expect(result.hunks[1].path).toBe("existing.txt")
|
||||
expect(result.hunks[1].chunks).toHaveLength(1)
|
||||
expect(result.hunks[1].chunks[0].old_lines).toEqual(["old content", "line to remove", "more content"])
|
||||
expect(result.hunks[1].chunks[0].new_lines).toEqual(["old content", "line to add", "more content"])
|
||||
expect(result.hunks[1].chunks[0].change_context).toBeUndefined()
|
||||
}
|
||||
|
||||
// Check delete operation
|
||||
expect(result.hunks[2].type).toBe("delete")
|
||||
expect(result.hunks[2].path).toBe("old-file.txt")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user