Skip to content

Commit 6ca96e0

Browse files
authored
tests(codewhisperer): fixed unit test case failing on windows for truncation lines (#3116)
## Problem Unit test cases of truncation lines for codeWhisperer were failing on windows OS. ## Solution We have to use vscode.uri.file() rather than vscode.Uri.parse(). The difference between Uri#parse and Uri#file is that the latter treats the argument as path, not as stringified-uri. E.g. Uri.file(path) is not the same as Uri.parse(‘file://’ + path) because the path might contain characters that are interpreted (# and ?).
1 parent c3c1105 commit 6ca96e0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/codewhisperer/util/dependencyGraph/javascriptDependencyGraph.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ describe('javascriptDependencyGraph', function () {
5959
describe('generateTruncation', function () {
6060
it('Should generate and return expected truncation', async function () {
6161
const javascriptDependencyGraph = new JavascriptDependencyGraph(CodeWhispererConstants.javascript)
62-
const truncation = await javascriptDependencyGraph.generateTruncation(vscode.Uri.parse(appCodePath))
62+
const truncation = await javascriptDependencyGraph.generateTruncation(vscode.Uri.file(appCodePath))
6363
assert.ok(truncation.root.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
6464
assert.ok(truncation.src.dir.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
6565
assert.ok(truncation.src.zip.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
66-
// assert.ok(truncation.lines > 0)
67-
// assert.ok(truncation.src.size > 0)
66+
assert.ok(truncation.lines > 0)
67+
assert.ok(truncation.src.size > 0)
6868
})
6969
})
7070
})

src/test/codewhisperer/util/dependencyGraph/pythonDependencyGraph.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ describe('pythonDependencyGraph', function () {
6060
describe('generateTruncation', function () {
6161
it('Should generate and return expected truncation', async function () {
6262
const pythonDependencyGraph = new PythonDependencyGraph(languageId)
63-
const truncation = await pythonDependencyGraph.generateTruncation(vscode.Uri.parse(appCodePath))
63+
const truncation = await pythonDependencyGraph.generateTruncation(vscode.Uri.file(appCodePath))
6464
assert.ok(truncation.root.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
6565
assert.ok(truncation.src.dir.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
6666
assert.ok(truncation.src.zip.includes(CodeWhispererConstants.codeScanTruncDirPrefix))
67-
// assert.ok(truncation.lines > 0)
68-
// assert.ok(truncation.src.size > 0)
67+
assert.ok(truncation.lines > 0)
68+
assert.ok(truncation.src.size > 0)
6969
})
7070
})
7171
})

0 commit comments

Comments
 (0)