feat: add factory sample machines and robot pricing conversations

This commit is contained in:
2026-10-28 12:53:07 +03:30
parent d0da416923
commit 55d4123fe5
71 changed files with 8179 additions and 3978 deletions
+25
View File
@@ -0,0 +1,25 @@
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 passes cancellation to both requests', 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).toHaveBeenCalledWith('./imagery/index.json', { signal: controller.signal });
});
});