@@ -38,30 +38,19 @@ describe('crossFileContextUtil', function () {
38
38
tempFolder = ( await createTestWorkspaceFolder ( ) ) . uri . fsPath
39
39
} )
40
40
41
- describe ( 'should fetch 10 chunks and each chunk should contains 50 lines' , function ( ) {
41
+ describe ( 'should fetch 3 chunks and each chunk should contains 10 lines' , function ( ) {
42
42
async function assertCorrectCodeChunk ( ) {
43
- await openATextEditorWithText ( sampleFileOf60Lines . repeat ( 10 ) , 'CrossFile.java' , tempFolder , {
44
- preview : false ,
45
- } )
43
+ await openATextEditorWithText ( sampleFileOf60Lines , 'CrossFile.java' , tempFolder , { preview : false } )
46
44
const myCurrentEditor = await openATextEditorWithText ( '' , 'TargetFile.java' , tempFolder , {
47
45
preview : false ,
48
46
} )
49
47
const actual = await crossFile . fetchSupplementalContextForSrc ( myCurrentEditor , fakeCancellationToken )
50
48
assert . ok ( actual )
51
- assert . ok ( actual . supplementalContextItems . length === crossFileContextConfig . topK )
52
-
53
- assert . strictEqual (
54
- actual . supplementalContextItems [ 0 ] . content . split ( '\n' ) . length ,
55
- crossFileContextConfig . numberOfLinesEachChunk
56
- )
57
- assert . strictEqual (
58
- actual . supplementalContextItems [ 1 ] . content . split ( '\n' ) . length ,
59
- crossFileContextConfig . numberOfLinesEachChunk
60
- )
61
- assert . strictEqual (
62
- actual . supplementalContextItems [ 2 ] . content . split ( '\n' ) . length ,
63
- crossFileContextConfig . numberOfLinesEachChunk
64
- )
49
+ assert . ok ( actual . supplementalContextItems . length === 3 )
50
+
51
+ assert . strictEqual ( actual . supplementalContextItems [ 0 ] . content . split ( '\n' ) . length , 10 )
52
+ assert . strictEqual ( actual . supplementalContextItems [ 1 ] . content . split ( '\n' ) . length , 10 )
53
+ assert . strictEqual ( actual . supplementalContextItems [ 2 ] . content . split ( '\n' ) . length , 10 )
65
54
}
66
55
67
56
it ( 'control group' , async function ( ) {
@@ -278,12 +267,12 @@ describe('crossFileContextUtil', function () {
278
267
assert . strictEqual ( chunks [ 1 ] . content , 'line_6\nline_7' )
279
268
} )
280
269
281
- it ( 'codewhisperer crossfile config should use 50 lines' , async function ( ) {
270
+ it ( 'codewhisperer crossfile config should use 10 lines' , async function ( ) {
282
271
const filePath = path . join ( tempFolder , 'file.txt' )
283
272
await toFile ( sampleFileOf60Lines , filePath )
284
273
285
274
const chunks = await crossFile . splitFileToChunks ( filePath , crossFileContextConfig . numberOfLinesEachChunk )
286
- assert . strictEqual ( chunks . length , 2 )
275
+ assert . strictEqual ( chunks . length , 6 )
287
276
} )
288
277
} )
289
278
} )
0 commit comments