mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
refactor(env/java): improve tests and implementation (#1246)
This basically fixes up the changes from #1220. * test(env/java): replace test that duplicates implementation * test(env/java): stub _ensure to focus on unit under test * test(env/java): add test for invalid output * refactor(env/java): keep try block small * refactor(env/java): shorten excessive comment
This commit is contained in:
committed by
GitHub
parent
6d803e2f72
commit
0f13f4a5ac
@@ -64,25 +64,6 @@ describe('check_reqs', function () {
|
||||
|
||||
await expectAsync(check_reqs.check_java()).toBeResolvedTo({ version: '1.8.0' });
|
||||
});
|
||||
|
||||
it('should return the correct version if javac prints _JAVA_OPTIONS', async () => {
|
||||
check_reqs.__set__({
|
||||
java: {
|
||||
getVersion: async () => {
|
||||
let version = null;
|
||||
const javacOutput = 'Picked up _JAVA_OPTIONS: -Xms1024M -Xmx2048M\njavac 1.8.0_271';
|
||||
const match = /javac\s+([\d.]+)/i.exec(javacOutput);
|
||||
if (match && match[1]) {
|
||||
version = match[1];
|
||||
}
|
||||
|
||||
return { version };
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await expectAsync(check_reqs.check_java()).toBeResolvedTo({ version: '1.8.0' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('check_android', function () {
|
||||
|
||||
Reference in New Issue
Block a user