mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-09 07:25:44 +02:00
Improved frontend tests
This commit is contained in:
Binary file not shown.
@@ -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 {
|
||||
|
||||
@@ -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,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd frontend
|
||||
npm run lint
|
||||
npm test
|
||||
cd ..
|
||||
|
||||
Reference in New Issue
Block a user