Public source validation / validate (push) Failing after 3m8s
31 lines
1.8 KiB
TypeScript
31 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { buildStorageNodes, type StorageData } from '../../src/StoragePage';
|
|
|
|
function data(): StorageData {
|
|
return {
|
|
array: { source: { state: 'operational', freshness: 'fresh' }, state: 'operational', members: [{ id: 'disk-10', name: 'disk10', role: 'data', state: 'online' }] },
|
|
disks: { source: { state: 'healthy', freshness: 'fresh' }, disks: [{ id: 'DISK-10', name: 'disk10', role: 'data', state: 'online', utilizationPercent: 99.99, capacitySeverity: 'critical', thermalSeverity: 'normal' }, { id: 'cache', name: 'cache', role: 'cache', state: 'online', utilizationPercent: 85.5, capacitySeverity: 'attention', thermalSeverity: 'critical' }] },
|
|
pools: { source: { state: 'healthy', freshness: 'fresh' }, pools: [{ id: 'cache', name: 'cache', filesystem: 'zfs', state: 'healthy', utilizationPercent: 85.5, capacitySeverity: 'attention' }] },
|
|
};
|
|
}
|
|
|
|
describe('buildStorageNodes', () => {
|
|
it('merges array and disk observations by canonical physical identity', () => {
|
|
const nodes = buildStorageNodes(data());
|
|
expect(nodes.filter((node) => node.label === 'disk10')).toHaveLength(1);
|
|
expect(nodes).toHaveLength(3);
|
|
});
|
|
|
|
it('keeps availability, capacity and thermal signals visible', () => {
|
|
const nodes = buildStorageNodes(data());
|
|
const disk = nodes.find((node) => node.label === 'disk10');
|
|
const cacheDisk = nodes.find((node) => node.id === 'disk-cache');
|
|
const cachePool = nodes.find((node) => node.id === 'pool-cache');
|
|
expect(disk).toMatchObject({ state: 'critical' });
|
|
expect(disk?.detail).toContain('Beschikbaarheid normaal · capaciteit kritiek · temperatuur normaal');
|
|
expect(cacheDisk).toMatchObject({ state: 'critical' });
|
|
expect(cachePool?.detail).toContain('Device-health normaal · capaciteit aandacht');
|
|
});
|
|
});
|