GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ui/deploy.config.test.mjs at main · base/ui Expand file tree/ Copy pathdeploy.config.test.mjsMore file actions 76 lines (67 loc) · 2.73 KB / Copy pathdeploy.config.test.mjsFile metadata and controls76 lines (67 loc) · 2.73 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 import { afterEach, describe, expect, it, vi } from 'vitest'; // deploy.config.mjs reads NEXT_PUBLIC_DEPLOY_TARGET at module-evaluation time, so // each case stubs the env and re-imports with a fresh module registry. async function loadWithTarget(target) { vi.resetModules(); vi.stubEnv('NEXT_PUBLIC_DEPLOY_TARGET', target); return import('./deploy.config.mjs'); } afterEach(() => { vi.unstubAllEnvs(); }); describe('deploy.config', () => { it('defaults to external when the target is unset', async () => { const c = await loadWithTarget(undefined); expect(c.TARGET).toBe('external'); }); it('treats any non-internal value as external', async () => { const c = await loadWithTarget('nonsense'); expect(c.TARGET).toBe('external'); }); describe('external target', () => { it('excludes internal-only surfaces', async () => { const c = await loadWithTarget('external'); expect(c.surfaceEnabled('internal-explorer')).toBe(false); expect(c.surfaceEnabled('benchmark')).toBe(false); expect(c.surfaceEnabled('scaling')).toBe(false); }); it('reports the disabled route + api prefixes and subtree globs', async () => { const c = await loadWithTarget('external'); expect(c.disabledRoutePrefixes()).toEqual(['/internal-explorer', '/tips', '/benchmark', '/scaling']); // Benchmark contributes no api prefix: it calls the report API directly // from the browser rather than through a route handler in this app. expect(c.disabledApiPrefixes()).toEqual(['/api/internal-explorer', '/api/tips']); expect(c.disabledRouteGlobs()).toEqual([ '/internal-explorer', '/internal-explorer/**', '/tips', '/tips/**', '/benchmark', '/benchmark/**', '/scaling', '/scaling/**', ]); }); }); describe('internal target', () => { it('includes internal-only surfaces', async () => { const c = await loadWithTarget('internal'); expect(c.TARGET).toBe('internal'); expect(c.surfaceEnabled('internal-explorer')).toBe(true); expect(c.surfaceEnabled('benchmark')).toBe(true); expect(c.surfaceEnabled('scaling')).toBe(true); }); it('disables nothing', async () => { const c = await loadWithTarget('internal'); expect(c.disabledRoutePrefixes()).toEqual([]); expect(c.disabledApiPrefixes()).toEqual([]); expect(c.disabledRouteGlobs()).toEqual([]); }); }); it('treats surfaces absent from the matrix as enabled everywhere', async () => { const external = await loadWithTarget('external'); expect(external.surfaceEnabled('snapshots')).toBe(true); const internal = await loadWithTarget('internal'); expect(internal.surfaceEnabled('snapshots')).toBe(true); }); }); |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |