@mintlify/previewing 4.0.1644 → 4.0.1646

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,17 @@ describe('isOnline', () => {
62
62
  process.off('unhandledRejection', onUnhandled);
63
63
  expect(unhandled).toEqual([]);
64
64
  });
65
+ it('returns true when only the client releases host is reachable', async () => {
66
+ vi.spyOn(os, 'networkInterfaces').mockReturnValue(externalInterfaces);
67
+ const fetchMock = vi.fn(async (url) => {
68
+ if (String(url).startsWith('https://releases.mintlify.com/'))
69
+ return okResponse();
70
+ throw new Error('blocked by egress policy');
71
+ });
72
+ vi.stubGlobal('fetch', fetchMock);
73
+ await expect(isOnline(1_000)).resolves.toBe(true);
74
+ expect(fetchMock).toHaveBeenCalledWith('https://releases.mintlify.com/mint-version.txt', expect.anything());
75
+ });
65
76
  it('returns false when every probe fails', async () => {
66
77
  vi.spyOn(os, 'networkInterfaces').mockReturnValue(externalInterfaces);
67
78
  vi.stubGlobal('fetch', vi.fn(async () => ({ ok: false, status: 503 })));
@@ -1,5 +1,7 @@
1
1
  import os from 'node:os';
2
+ import { TARGET_MINT_VERSION_URL } from '../constants.js';
2
3
  const PROBE_URLS = [
4
+ TARGET_MINT_VERSION_URL,
3
5
  'https://captive.apple.com/hotspot-detect.html',
4
6
  'https://cloudflare.com/cdn-cgi/trace',
5
7
  ];