Files
vending-machine-game/src/services/apiClient.test.js
T
HamedandClaude Opus 5.5 526796126d
CI/CD / test (push) Successful in 57s
CI/CD / publish (push) Successful in 1m8s
CI/CD / deploy (push) Successful in 6s
fix: draw street map ground and repair mobile layout
- Turn the satellite ground off behind SATELLITE_GROUND so OSM streets,
  parks and land use are drawn; the imagery index is no longer fetched.
- Restore phone rules lost in the CSS-to-JS theme migration (#rank
  height, toolbar button size) and replace invalid -var() values.
- Add a landscape-phone layout and make the briefing scrollable.
- Add two-finger pinch zoom to the big map.
- Add regression tests for the theme and the skipped imagery request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 07:51:40 +03:30

26 lines
1.2 KiB
JavaScript

import { describe, it, expect, vi, afterEach } from 'vitest';
afterEach(() => {
vi.restoreAllMocks();
history.replaceState({}, '', '/');
});
describe('world asset service', () => {
it('resolves a Pages repository directory without inheriting query parameters', async () => {
history.replaceState({}, '', '/vending-machine-game/?debug');
vi.resetModules();
const { apiClient } = await import('./apiClient.js');
expect(apiClient.defaults.baseURL).toBe(`${location.origin}/vending-machine-game/`);
});
it('retains the optional-data fallback and skips the satellite index while it is off', async () => {
const { apiClient } = await import('./apiClient.js');
const { loadWorldFiles } = await import('./worldService.js');
const get = vi.spyOn(apiClient, 'get').mockRejectedValue(new Error('offline'));
const controller = new AbortController();
expect(await loadWorldFiles(controller.signal)).toEqual([null, null]);
expect(get).toHaveBeenCalledWith('./data/buildings.bin', {
responseType: 'arraybuffer',
signal: controller.signal,
});
expect(get).not.toHaveBeenCalledWith('./imagery/index.json', expect.anything());
});
});