|
| 1 | +/*! |
| 2 | + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +import * as assert from 'assert' |
| 7 | +import * as utgUtils from '../../../codewhisperer/util/supplementalContext/utgUtils' |
| 8 | +import { UserGroup } from '../../../codewhisperer/models/constants' |
| 9 | + |
| 10 | +describe('shouldFetchUtgContext', () => { |
| 11 | + it('fully supported language', function () { |
| 12 | + assert.ok(utgUtils.shouldFetchUtgContext('java', UserGroup.Control)) |
| 13 | + assert.ok(utgUtils.shouldFetchUtgContext('java', UserGroup.CrossFile)) |
| 14 | + }) |
| 15 | + |
| 16 | + it('partially supported language', () => { |
| 17 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('python', UserGroup.Control), false) |
| 18 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('python', UserGroup.CrossFile), true) |
| 19 | + }) |
| 20 | + |
| 21 | + it('not supported language', () => { |
| 22 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('typescript', UserGroup.Control), undefined) |
| 23 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('typescript', UserGroup.CrossFile), undefined) |
| 24 | + |
| 25 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('javascript', UserGroup.Control), undefined) |
| 26 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('javascript', UserGroup.CrossFile), undefined) |
| 27 | + |
| 28 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('javascriptreact', UserGroup.Control), undefined) |
| 29 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('javascriptreact', UserGroup.CrossFile), undefined) |
| 30 | + |
| 31 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('typescriptreact', UserGroup.Control), undefined) |
| 32 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('typescriptreact', UserGroup.CrossFile), undefined) |
| 33 | + |
| 34 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('scala', UserGroup.Control), undefined) |
| 35 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('scala', UserGroup.CrossFile), undefined) |
| 36 | + |
| 37 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('shellscript', UserGroup.Control), undefined) |
| 38 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('shellscript', UserGroup.CrossFile), undefined) |
| 39 | + |
| 40 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('csharp', UserGroup.Control), undefined) |
| 41 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('csharp', UserGroup.CrossFile), undefined) |
| 42 | + |
| 43 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('c', UserGroup.Control), undefined) |
| 44 | + assert.strictEqual(utgUtils.shouldFetchUtgContext('c', UserGroup.CrossFile), undefined) |
| 45 | + }) |
| 46 | +}) |
0 commit comments