@orcdkestrator/orcdk-plugin-localstack
Version:
LocalStack lifecycle management plugin for Orcdkestrator
70 lines • 4.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const runtime_config_1 = require("../runtime-config");
describe('Runtime Configuration', () => {
describe('DEFAULT_RUNTIME_FILE_EXTENSIONS', () => {
it('should have Python runtime mappings', () => {
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['python']).toEqual(['.py']);
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['python3.8']).toEqual(['.py']);
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['python3.12']).toEqual(['.py']);
});
it('should have Node.js runtime mappings', () => {
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['nodejs18.x']).toContain('.js');
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['nodejs18.x']).toContain('.ts');
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['nodejs18.x']).toContain('.mjs');
});
it('should have Java runtime mappings', () => {
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['java11']).toContain('.java');
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['java11']).toContain('.jar');
});
it('should have other runtime mappings', () => {
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['dotnet6']).toContain('.cs');
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['ruby3.2']).toContain('.rb');
expect(runtime_config_1.DEFAULT_RUNTIME_FILE_EXTENSIONS['go1.x']).toContain('.go');
});
});
describe('getFileExtensionsForRuntime', () => {
it('should return extensions for exact runtime match', () => {
expect((0, runtime_config_1.getFileExtensionsForRuntime)('python3.8')).toEqual(['.py']);
expect((0, runtime_config_1.getFileExtensionsForRuntime)('nodejs18.x')).toEqual(['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx']);
});
it('should handle future runtime versions gracefully', () => {
// Python 3.13 doesn't exist yet but should work
expect((0, runtime_config_1.getFileExtensionsForRuntime)('python3.13')).toEqual(['.py']);
// Node.js 24.x doesn't exist yet but should work
expect((0, runtime_config_1.getFileExtensionsForRuntime)('nodejs24.x')).toEqual(['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx']);
// Java 25 doesn't exist yet but should work
expect((0, runtime_config_1.getFileExtensionsForRuntime)('java25')).toEqual(['.java', '.jar', '.class']);
});
it('should return default extensions for unknown runtimes', () => {
expect((0, runtime_config_1.getFileExtensionsForRuntime)('unknown-runtime')).toEqual(runtime_config_1.DEFAULT_FILE_EXTENSIONS);
expect((0, runtime_config_1.getFileExtensionsForRuntime)('custom-lang-1.0')).toEqual(runtime_config_1.DEFAULT_FILE_EXTENSIONS);
});
it('should use custom mappings when provided', () => {
const customMappings = {
'mylang': ['.ml', '.mli'],
'python3.8': ['.py', '.pyx', '.pyi'], // Override default
};
expect((0, runtime_config_1.getFileExtensionsForRuntime)('mylang', customMappings)).toEqual(['.ml', '.mli']);
expect((0, runtime_config_1.getFileExtensionsForRuntime)('python3.8', customMappings)).toEqual(['.py', '.pyx', '.pyi']);
});
it('should handle partial runtime matches', () => {
// Should match 'python3' when 'python3.99' is not found
expect((0, runtime_config_1.getFileExtensionsForRuntime)('python3.99')).toEqual(['.py']);
// Should match 'nodejs' when 'nodejs99.x' is not found
expect((0, runtime_config_1.getFileExtensionsForRuntime)('nodejs99.x')).toEqual(['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx']);
});
it('should handle runtime family matches', () => {
// Should match 'python' when 'python4' is not found
expect((0, runtime_config_1.getFileExtensionsForRuntime)('python4')).toEqual(['.py']);
// Should match 'java' when 'java99' is not found
expect((0, runtime_config_1.getFileExtensionsForRuntime)('java99')).toEqual(['.java', '.jar', '.class']);
});
it('should be case sensitive', () => {
// Runtimes are case sensitive in AWS Lambda
expect((0, runtime_config_1.getFileExtensionsForRuntime)('Python3.8')).toEqual(runtime_config_1.DEFAULT_FILE_EXTENSIONS);
expect((0, runtime_config_1.getFileExtensionsForRuntime)('NODEJS18.X')).toEqual(runtime_config_1.DEFAULT_FILE_EXTENSIONS);
});
});
});
//# sourceMappingURL=runtime-config.test.js.map