11import { describe , expect , it } from "vitest" ;
2- import { normalizeToLF } from "../../line-endings.js" ;
3- import { applyEditsToNormalizedContent , generateDiffString } from "./edit-diff.js" ;
2+ import { applyEditsPreservingLineEndings , generateDiffString } from "./edit-diff.js" ;
43
54function getMismatchMessage (
65 content : string ,
76 edits : Array < { oldText : string ; newText : string } > ,
87) : string {
98 try {
10- applyEditsToNormalizedContent ( normalizeToLF ( content ) , edits , "test.ts" ) ;
9+ applyEditsPreservingLineEndings ( content , edits , "test.ts" ) ;
1110 } catch ( error ) {
1211 return error instanceof Error ? error . message : String ( error ) ;
1312 }
@@ -142,8 +141,8 @@ describe("applyEditsToNormalizedContent uniqueness", () => {
142141 it ( "replaces an exactly unique match when trailing whitespace makes a sibling line fuzzy-identical" , ( ) => {
143142 const content = "foo(); \nfoo();\nbar();\n" ;
144143
145- const result = applyEditsToNormalizedContent (
146- normalizeToLF ( content ) ,
144+ const result = applyEditsPreservingLineEndings (
145+ content ,
147146 [ { oldText : "foo();\n" , newText : "baz();\n" } ] ,
148147 "test.ts" ,
149148 ) ;
@@ -157,8 +156,8 @@ describe("applyEditsToNormalizedContent fuzzy uniqueness", () => {
157156 const content = "foo(); \nfoo();\t\nbar();\n" ;
158157
159158 expect ( ( ) =>
160- applyEditsToNormalizedContent (
161- normalizeToLF ( content ) ,
159+ applyEditsPreservingLineEndings (
160+ content ,
162161 [ { oldText : "foo();\n" , newText : "baz();\n" } ] ,
163162 "test.ts" ,
164163 ) ,
0 commit comments