3b9d007e8b
Headlamp plugin providing visibility into kube-vip virtual IP and load balancer deployments. Features: - Overview dashboard with deployment status, VIP mode, leader election - Services page with LoadBalancer VIP assignments and detail panels - Nodes page showing kube-vip pod status and leader designation - Configuration page with DaemonSet config, IP pools, leases - Service detail section injected into native Headlamp Service views Read-only plugin — no cluster write operations. Uses standard K8s resources (no CRDs): Services, Nodes, Pods, DaemonSets, Leases, ConfigMaps with kube-vip.io/* annotations. 74 tests across 7 test files. All tsc/lint/format/test checks pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import '@testing-library/jest-dom';
|
|
|
|
// Node 22+ ships a minimal built-in `localStorage` global (property-bag only,
|
|
// no getItem/setItem/removeItem/clear) that shadows jsdom's Web Storage
|
|
// implementation. Provide a spec-compliant shim so code under test works.
|
|
if (typeof localStorage !== 'undefined' && typeof localStorage.getItem !== 'function') {
|
|
const store = new Map<string, string>();
|
|
|
|
const storage = {
|
|
getItem(key: string): string | null {
|
|
return store.get(key) ?? null;
|
|
},
|
|
setItem(key: string, value: string): void {
|
|
store.set(key, String(value));
|
|
},
|
|
removeItem(key: string): void {
|
|
store.delete(key);
|
|
},
|
|
clear(): void {
|
|
store.clear();
|
|
},
|
|
get length(): number {
|
|
return store.size;
|
|
},
|
|
key(index: number): string | null {
|
|
return [...store.keys()][index] ?? null;
|
|
},
|
|
};
|
|
|
|
Object.defineProperty(globalThis, 'localStorage', {
|
|
value: storage,
|
|
writable: true,
|
|
configurable: true,
|
|
});
|
|
|
|
if (typeof window !== 'undefined') {
|
|
Object.defineProperty(window, 'localStorage', {
|
|
value: storage,
|
|
writable: true,
|
|
configurable: true,
|
|
});
|
|
}
|
|
}
|