forked from aws/aws-toolkit-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemaCodeLangs.test.ts
More file actions
60 lines (57 loc) · 2.25 KB
/
schemaCodeLangs.test.ts
File metadata and controls
60 lines (57 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'assert'
import {
getApiValueForSchemasDownload,
getLanguageDetails,
schemaCodeLangs,
} from '../../../eventSchemas/models/schemaCodeLangs'
import { samZipLambdaRuntimes } from '../../../lambda/models/samLambdaRuntime'
import { Runtime } from '@aws-sdk/client-lambda'
describe('getLanguageDetails', function () {
it('should successfully return details for supported languages', function () {
for (const language of schemaCodeLangs.values()) {
const result = getLanguageDetails(language)
assert.ok(
result,
`Language : ${language}, api value : ${result.apiValue}, language extension : ${result.extension}`
)
}
})
})
describe('getApiValueForSchemasDownload', function () {
it('should return api value for runtimes supported by eventBridge application', async function () {
for (const runtime of samZipLambdaRuntimes.values()) {
switch (runtime) {
case 'python3.7':
case 'python3.8':
case 'python3.9':
case 'python3.11':
case 'python3.12':
case 'python3.13' as Runtime:
case 'python3.14' as Runtime:
case 'python3.10': {
const result = getApiValueForSchemasDownload(runtime)
assert.strictEqual(result, 'Python36', 'Api value used by schemas api')
break
}
case 'go1.x': {
const result = getApiValueForSchemasDownload(runtime)
assert.strictEqual(result, 'Go1', 'Api value used by schemas api')
break
}
default: {
const errorMessage = `Runtime ${runtime} is not supported by eventBridge application`
assert.throws(
() => getApiValueForSchemasDownload(runtime),
new Error(errorMessage),
'Should fail for same error'
)
break
}
}
}
})
})