@@ -2,6 +2,15 @@ import { expect, describe, it } from 'bun:test'
22
33import { parseAndGetDiffBlocksSingleFile } from '../generate-diffs-prompt'
44
5+ import type { Logger } from '@codebuff/types/logger'
6+
7+ const logger : Logger = {
8+ debug : ( ) => { } ,
9+ info : ( ) => { } ,
10+ warn : ( ) => { } ,
11+ error : ( ) => { } ,
12+ }
13+
514describe ( 'parseAndGetDiffBlocksSingleFile' , ( ) => {
615 it ( 'should parse diff blocks with newline before closing marker' , ( ) => {
716 const oldContent = 'function test() {\n return true;\n}\n'
@@ -16,7 +25,11 @@ function test() {
1625}
1726>>>>>>> REPLACE`
1827
19- const result = parseAndGetDiffBlocksSingleFile ( newContent , oldContent )
28+ const result = parseAndGetDiffBlocksSingleFile ( {
29+ newContent,
30+ oldFileContent : oldContent ,
31+ logger,
32+ } )
2033 console . log ( JSON . stringify ( { result } ) )
2134
2235 expect ( result . diffBlocks . length ) . toBe ( 1 )
@@ -41,7 +54,11 @@ function test() {
4154 return true;
4255}>>>>>>> REPLACE`
4356
44- const result = parseAndGetDiffBlocksSingleFile ( newContent , oldContent )
57+ const result = parseAndGetDiffBlocksSingleFile ( {
58+ newContent,
59+ oldFileContent : oldContent ,
60+ logger,
61+ } )
4562
4663 expect ( result . diffBlocks . length ) . toBe ( 1 )
4764 expect ( result . diffBlocksThatDidntMatch . length ) . toBe ( 0 )
@@ -90,7 +107,11 @@ function subtract(a, b) {
90107}
91108>>>>>>> REPLACE`
92109
93- const result = parseAndGetDiffBlocksSingleFile ( newContent , oldContent )
110+ const result = parseAndGetDiffBlocksSingleFile ( {
111+ newContent,
112+ oldFileContent : oldContent ,
113+ logger,
114+ } )
94115
95116 expect ( result . diffBlocks . length ) . toBe ( 2 )
96117 expect ( result . diffBlocksThatDidntMatch . length ) . toBe ( 0 )
@@ -114,7 +135,11 @@ function subtract(a, b) {
114135=======
115136>>>>>>> REPLACE`
116137
117- const result = parseAndGetDiffBlocksSingleFile ( newContent , oldContent )
138+ const result = parseAndGetDiffBlocksSingleFile ( {
139+ newContent,
140+ oldFileContent : oldContent ,
141+ logger,
142+ } )
118143
119144 expect ( result . diffBlocks . length ) . toBe ( 1 )
120145 expect ( result . diffBlocksThatDidntMatch . length ) . toBe ( 0 )
0 commit comments