fix(hashline-edit): improve hash computation and tool description clarity
- Include line number in hash computation to ensure uniqueness - Add explicit examples of WRONG vs CORRECT LINE:HASH format - Clarify that hash must be hex characters (0-9, a-f only) - Update tests to use dynamic hash computation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, it, expect } from "bun:test"
|
||||
import { computeLineHash } from "./hash-computation"
|
||||
import { parseLineRef, validateLineRef } from "./validation"
|
||||
|
||||
describe("parseLineRef", () => {
|
||||
@@ -61,7 +62,7 @@ describe("validateLineRef", () => {
|
||||
it("validates matching hash", () => {
|
||||
//#given
|
||||
const lines = ["function hello() {", " return 42", "}"]
|
||||
const ref = "1:42"
|
||||
const ref = `1:${computeLineHash(1, lines[0])}`
|
||||
|
||||
//#when & #then
|
||||
expect(() => validateLineRef(lines, ref)).not.toThrow()
|
||||
|
||||
Reference in New Issue
Block a user