@@ -58,7 +58,7 @@ describe('zipUtil', function () {
5858 )
5959 } )
6060
61- describe ( 'generateZip ' , function ( ) {
61+ describe ( 'generateZipCodeScan ' , function ( ) {
6262 let zipUtil : ZipUtil
6363 beforeEach ( function ( ) {
6464 zipUtil = new ZipUtil ( CodeWhispererConstants . codeScanTruncDirPrefix )
@@ -68,7 +68,7 @@ describe('zipUtil', function () {
6868 } )
6969
7070 it ( 'Should generate zip for file scan and return expected metadata' , async function ( ) {
71- const zipMetadata = await zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'file' , {
71+ const zipMetadata = await zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'file' , {
7272 includeGitDiff : true ,
7373 } )
7474 assert . strictEqual ( zipMetadata . lines , 49 )
@@ -84,13 +84,13 @@ describe('zipUtil', function () {
8484 sinon . stub ( ZipUtil , 'aboveByteLimit' ) . returns ( true )
8585
8686 await assert . rejects (
87- ( ) => zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'file' , { includeGitDiff : true } ) ,
87+ ( ) => zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'file' , { includeGitDiff : true } ) ,
8888 new ToolkitError ( `Payload size limit reached` , { code : 'FileSizeExceeded' } )
8989 )
9090 } )
9191
9292 it ( 'Should generate zip for project scan and return expected metadata' , async function ( ) {
93- const zipMetadata = await zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'project' )
93+ const zipMetadata = await zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'project' )
9494 assert . ok ( zipMetadata . lines > 0 )
9595 assert . ok ( zipMetadata . rootDir . includes ( codeScanTruncDirPrefix ) )
9696 assert . ok ( zipMetadata . srcPayloadSizeInBytes > 0 )
@@ -104,7 +104,7 @@ describe('zipUtil', function () {
104104 sinon . stub ( ZipUtil , 'aboveByteLimit' ) . returns ( true )
105105
106106 await assert . rejects (
107- ( ) => zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'project' ) ,
107+ ( ) => zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'project' ) ,
108108 new ToolkitError ( 'Payload size limit reached' , { code : 'ProjectSizeExceeded' } )
109109 )
110110 } )
@@ -113,29 +113,32 @@ describe('zipUtil', function () {
113113 sinon . stub ( ZipUtil , 'aboveByteLimit' ) . returns ( true )
114114
115115 await assert . rejects (
116- ( ) => zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'project' ) ,
116+ ( ) => zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'project' ) ,
117117 new ToolkitError ( 'Payload size limit reached' , { code : 'ProjectSizeExceeded' } )
118118 )
119119 } )
120120
121121 it ( 'Should read file content instead of from disk if file is dirty' , async function ( ) {
122- const zipMetadata = await zipUtil . generateZip ( vscode . Uri . file ( appCodePath ) , 'project' )
122+ const zipMetadata = await zipUtil . generateZipCodeScan ( vscode . Uri . file ( appCodePath ) , 'project' )
123123
124124 const document = await vscode . workspace . openTextDocument ( appCodePath )
125125 await vscode . window . showTextDocument ( document )
126126 void vscode . window . activeTextEditor ?. edit ( ( editBuilder ) => {
127127 editBuilder . insert ( new vscode . Position ( 0 , 0 ) , '// a comment\n' )
128128 } )
129129
130- const zipMetadata2 = await new ZipUtil ( CodeWhispererConstants . codeScanTruncDirPrefix ) . generateZip (
130+ const zipMetadata2 = await new ZipUtil ( CodeWhispererConstants . codeScanTruncDirPrefix ) . generateZipCodeScan (
131131 vscode . Uri . file ( appCodePath ) ,
132132 'project'
133133 )
134134 assert . equal ( zipMetadata2 . lines , zipMetadata . lines + 1 )
135135 } )
136136
137137 it ( 'should handle path with repeated project name for file scan' , async function ( ) {
138- const zipMetadata = await zipUtil . generateZip ( vscode . Uri . file ( appCodePathWithRepeatedProjectName ) , 'file' )
138+ const zipMetadata = await zipUtil . generateZipCodeScan (
139+ vscode . Uri . file ( appCodePathWithRepeatedProjectName ) ,
140+ 'file'
141+ )
139142
140143 const zipFileData = await fs . readFileBytes ( zipMetadata . zipFilePath )
141144 const zip = await JSZip . loadAsync ( zipFileData )
@@ -144,7 +147,7 @@ describe('zipUtil', function () {
144147 } )
145148
146149 it ( 'should handle path with repeated project name for project scan' , async function ( ) {
147- const zipMetadata = await zipUtil . generateZip (
150+ const zipMetadata = await zipUtil . generateZipCodeScan (
148151 vscode . Uri . file ( appCodePathWithRepeatedProjectName ) ,
149152 'project'
150153 )
0 commit comments