|
4 | 4 | */
|
5 | 5 |
|
6 | 6 | import assert from 'assert'
|
7 |
| -import { resetCodeWhispererGlobalVariables, toTextDocument } from 'aws-core-vscode/test' |
| 7 | +import { resetCodeWhispererGlobalVariables, TestFolder, toTextDocument } from 'aws-core-vscode/test' |
8 | 8 | import { runtimeLanguageContext, RuntimeLanguageContext, PlatformLanguageId } from 'aws-core-vscode/codewhisperer'
|
9 | 9 | import * as codewhispererClient from 'aws-core-vscode/codewhisperer'
|
10 | 10 | import { CodewhispererLanguage } from 'aws-core-vscode/shared'
|
11 | 11 |
|
12 | 12 | describe('runtimeLanguageContext', function () {
|
13 | 13 | const languageContext = new RuntimeLanguageContext()
|
| 14 | + let tempFolder: TestFolder |
| 15 | + |
| 16 | + before(async function () { |
| 17 | + tempFolder = await TestFolder.create() |
| 18 | + }) |
14 | 19 |
|
15 | 20 | describe('test isLanguageSupported', function () {
|
16 | 21 | const cases: [string, boolean][] = [
|
@@ -104,13 +109,12 @@ describe('runtimeLanguageContext', function () {
|
104 | 109 | ['helloUnknown', false],
|
105 | 110 | ['helloFoo.foo', false],
|
106 | 111 | ]
|
107 |
| - |
108 | 112 | for (const tuple of cases) {
|
109 | 113 | const fileName = tuple[0]
|
110 | 114 | const expected = tuple[1]
|
111 | 115 |
|
112 | 116 | it(`pass document ${fileName} as argument should first try determine by languageId then file extensions`, async function () {
|
113 |
| - const doc = await toTextDocument('', fileName) |
| 117 | + const doc = await toTextDocument('', fileName, tempFolder.path) |
114 | 118 | const actual = languageContext.isLanguageSupported(doc)
|
115 | 119 | assert.strictEqual(actual, expected)
|
116 | 120 | })
|
|
0 commit comments