mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-19 23:06:49 +00:00
test(security): add scan comparison coverage (#656)
Backend supertest suite for GET /api/security/compare covers tier gating, input validation, cross-node isolation, diff partitioning by vulnerability_id::pkg_name, suppression application, and cross-image comparison. Frontend vitest + React Testing Library scaffolding with component tests for ScanComparisonSheet (loading, error recovery, cross-image warning, filter pills, reload on id change) and SecurityHistoryView (mount fetch, selection cap, oldest-first baseline ordering, tier gating).
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
import { afterEach, vi } from 'vitest';
|
||||
import { cleanup } from '@testing-library/react';
|
||||
|
||||
class MockResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
}
|
||||
globalThis.ResizeObserver = globalThis.ResizeObserver ?? MockResizeObserver;
|
||||
|
||||
if (typeof window !== 'undefined' && !window.matchMedia) {
|
||||
window.matchMedia = 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(),
|
||||
}));
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
Reference in New Issue
Block a user