fix tests on windows

This commit is contained in:
Erwin Morrhey 2022-11-02 16:32:23 +01:00 committed by GitHub
parent 3eb41a6796
commit 10137ee6a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -199,7 +199,7 @@ describe('setupJava', () => {
const jdkFile = 'not_existing_one'; const jdkFile = 'not_existing_one';
const expected = { const expected = {
version: actualJavaVersion, version: actualJavaVersion,
path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents/Home') path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents', 'Home')
}; };
let originalPlatform = process.platform; let originalPlatform = process.platform;
Object.defineProperty(process, 'platform', { Object.defineProperty(process, 'platform', {
@ -208,7 +208,7 @@ describe('setupJava', () => {
spyFsStat = jest.spyOn(fs, 'existsSync'); spyFsStat = jest.spyOn(fs, 'existsSync');
spyFsStat.mockImplementation((file: string) => { spyFsStat.mockImplementation((file: string) => {
return file.endsWith('Contents/Home'); return file.endsWith('Home');
}); });
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
@ -234,7 +234,7 @@ describe('setupJava', () => {
const jdkFile = expectedJdkFile; const jdkFile = expectedJdkFile;
const expected = { const expected = {
version: '11.0.289', version: '11.0.289',
path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents/Home') path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents', 'Home')
}; };
let originalPlatform = process.platform; let originalPlatform = process.platform;
Object.defineProperty(process, 'platform', { Object.defineProperty(process, 'platform', {
@ -242,7 +242,7 @@ describe('setupJava', () => {
}); });
spyFsStat = jest.spyOn(fs, 'existsSync'); spyFsStat = jest.spyOn(fs, 'existsSync');
spyFsStat.mockImplementation((file: string) => { spyFsStat.mockImplementation((file: string) => {
return file.endsWith('Contents/Home'); return file.endsWith('Home');
}); });
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);