Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert JetBrains test mock: use real network calls now that cloudfron…
…t.net is whitelisted

Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/74ae64af-1192-420c-8c3e-aefa09bfb00a

Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
  • Loading branch information
Copilot and nbauma109 authored Apr 4, 2026
commit 3721876b1b2a9841d65f7b0d1d03eaadc1101ab2
11 changes: 4 additions & 7 deletions __tests__/distributors/jetbrains-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {HttpClient} from '@actions/http-client';
import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer';

import manifestData from '../data/jetbrains.json';
import os from 'os';

describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
let spyHttpClientHead: jest.SpyInstance;

beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
Expand All @@ -15,10 +15,6 @@ describe('getAvailableVersions', () => {
headers: {},
result: []
});
spyHttpClientHead = jest.spyOn(HttpClient.prototype, 'head');
spyHttpClientHead.mockReturnValue({
message: {statusCode: 200}
});
});

afterEach(() => {
Expand All @@ -44,8 +40,9 @@ describe('getAvailableVersions', () => {
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();

// manifestData items + 2 hidden versions (always included when head is mocked to return 200)
expect(availableVersions.length).toBe(manifestData.length + 2);
const length =
os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
expect(availableVersions.length).toBe(length);
}, 10_000);
});

Expand Down