Architecture validation for JDK file installs (#1324)

* Enhance architecture validation and error handling

* Improve architecture normalization and validation for custom tokens

* Refactor architecture validation to consolidate error handling for invalid tokens
This commit is contained in:
v-mahabaleshwars
2026-11-13 23:04:15 -05:00
committed by GitHub
parent 77dd5b2ce2
commit 9ce5b12cb9
5 changed files with 67 additions and 11 deletions
+30
View File
@@ -31,6 +31,36 @@ describe('Java platform capabilities', () => {
expect(normalizeArchitecture(input)).toBe(expected);
});
it.each(['constructor', 'Constructor'])(
'preserves custom architecture token %s for jdkfile',
architecture => {
expect(normalizeArchitecture(architecture)).toBe(architecture);
expect(validateJavaPlatform('jdkfile', 'linux', architecture, '17')).toBe(
architecture
);
}
);
it.each([
'x64<<end\nvalue\nend',
'z/OS',
'z/os',
'test0987654321=',
'++=++',
'../x64',
'x64\\other',
'x64 other',
'-x64',
'_x64'
])('rejects invalid architecture token %s', architecture => {
const message = `Unsupported architecture value: ${JSON.stringify(architecture)}`;
expect(() => normalizeArchitecture(architecture)).toThrow(message);
expect(() =>
validateJavaPlatform('jdkfile', 'linux', architecture, '17')
).toThrow(message);
});
it.each([
['linux', false, 'linux-glibc'],
['linux', true, 'linux-musl'],