Improved frontend tests

This commit is contained in:
maziggy
2026-01-30 13:02:57 +01:00
parent 4639fdacd1
commit 49acd8c148
5 changed files with 6 additions and 3 deletions
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
globalIgnores(['dist', 'coverage']),
{
files: ['**/*.{ts,tsx}'],
extends: [
@@ -2,7 +2,7 @@
* Tests for the GitHub Backup API client functions.
*/
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { describe, it, expect } from 'vitest';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
import type {
+3 -1
View File
@@ -544,14 +544,16 @@ export function SettingsPage() {
// Local state for camera URL inputs (to avoid saving on every keystroke)
const [localCameraUrls, setLocalCameraUrls] = useState<Record<number, string>>({});
const cameraUrlSaveTimeoutRef = useRef<Record<number, ReturnType<typeof setTimeout>>>({});
const initializedPrinterUrlsRef = useRef<Set<number>>(new Set());
// Initialize local camera URLs from printer data
useEffect(() => {
if (printers) {
const urls: Record<number, string> = {};
printers.forEach(p => {
if (p.external_camera_url && localCameraUrls[p.id] === undefined) {
if (p.external_camera_url && !initializedPrinterUrlsRef.current.has(p.id)) {
urls[p.id] = p.external_camera_url;
initializedPrinterUrlsRef.current.add(p.id);
}
});
if (Object.keys(urls).length > 0) {
+1
View File
@@ -1,5 +1,6 @@
#!/bin/sh
cd frontend
npm run lint
npm test
cd ..