Merge branch 'main' into chore/more-warnings

This commit is contained in:
2026-01-30 12:43:52 +01:00
16 changed files with 67 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ import {
useExperimentLogger,
useStatusLogger
} from '../../../src/pages/MonitoringPage/MonitoringPageAPI';
import { API_BASE_URL } from '../../../src/config/api.ts';
// --- MOCK EVENT SOURCE SETUP ---
// This mocks the browser's EventSource so we can manually 'push' messages to our hooks
@@ -72,7 +73,7 @@ describe('MonitoringPageAPI', () => {
await sendAPICall('test_type', 'test_ctx');
expect(globalThis.fetch).toHaveBeenCalledWith(
'http://localhost:8000/button_pressed',
`${API_BASE_URL}/button_pressed`,
expect.objectContaining({
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -220,4 +221,4 @@ describe('MonitoringPageAPI', () => {
expect(consoleSpy).toHaveBeenCalledWith('Status stream error:', expect.any(Error));
});
});
});
});

View File

@@ -3,6 +3,7 @@
// © Copyright Utrecht University (Department of Information and Computing Sciences)
import { render, screen, act, cleanup, fireEvent } from '@testing-library/react';
import Robot from '../../../src/pages/Robot/Robot';
import { API_BASE_URL } from '../../../src/config/api.ts';
// Mock EventSource
const mockInstances: MockEventSource[] = [];
@@ -64,7 +65,7 @@ describe('Robot', () => {
await act(async () => fireEvent.click(button));
expect(globalThis.fetch).toHaveBeenCalledWith(
'http://localhost:8000/message',
`${API_BASE_URL}/message`,
expect.objectContaining({
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -83,7 +84,7 @@ describe('Robot', () => {
);
expect(globalThis.fetch).toHaveBeenCalledWith(
'http://localhost:8000/message',
`${API_BASE_URL}/message`,
expect.objectContaining({
method: 'POST',
headers: { 'Content-Type': 'application/json' },