mirror of
https://github.com/dpup/meshstream.git
synced 2026-03-28 17:42:37 +01:00
* Fix network map mobile overflow and infer MQTT hops from SNR=0 - Add min-h-0 and flex-shrink-0 to map layout so legend/actions don't overflow the viewport on mobile - Infer viaMqtt=true for traceroute hops with SNR exactly 0 - Change MQTT hop color from purple to orange across map, legend, and node detail badges https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C * Revert MQTT color to purple; keep SNR=0 MQTT inference The color change was unintended — MQTT hops should stay purple. The SNR=0 inference in traceroute processing correctly marks those hops as viaMqtt so they render as purple dashed lines. https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C * Fix test setup: mock URL.createObjectURL for maplibre-gl maplibre-gl calls URL.createObjectURL during import for its worker setup, which doesn't exist in jsdom. Add the mock to test setup. https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C * Run go fmt on unformatted files https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C --------- Co-authored-by: Claude <noreply@anthropic.com>
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import '@testing-library/jest-dom';
|
|
import { vi } from 'vitest';
|
|
|
|
// Mock URL.createObjectURL (required by maplibre-gl worker setup)
|
|
if (typeof window.URL.createObjectURL === 'undefined') {
|
|
window.URL.createObjectURL = vi.fn(() => '');
|
|
}
|
|
if (typeof window.URL.revokeObjectURL === 'undefined') {
|
|
window.URL.revokeObjectURL = vi.fn();
|
|
}
|
|
|
|
// Mock for window.matchMedia
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query: string) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(),
|
|
removeListener: vi.fn(),
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|
|
|
|
// Mock for ResizeObserver
|
|
window.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}));
|
|
|
|
// Mock for EventSource
|
|
class MockEventSource {
|
|
onmessage: ((event: any) => void) | null = null;
|
|
onerror: ((event: any) => void) | null = null;
|
|
|
|
constructor(public url: string) {}
|
|
|
|
close() {
|
|
// Do nothing
|
|
}
|
|
|
|
addEventListener(event: string, callback: (event: any) => void) {
|
|
if (event === 'message') {
|
|
this.onmessage = callback;
|
|
} else if (event === 'error') {
|
|
this.onerror = callback;
|
|
}
|
|
}
|
|
|
|
removeEventListener(event: string, callback: (event: any) => void) {
|
|
if (event === 'message' && this.onmessage === callback) {
|
|
this.onmessage = null;
|
|
} else if (event === 'error' && this.onerror === callback) {
|
|
this.onerror = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Override EventSource globally
|
|
window.EventSource = MockEventSource as any; |