Files
Void-Homelab/tests/frontend/card_registry.test.js
root c3a3ac4feb feat(sacred-valley): card factory, registry ordering, view skeleton
Adds the Plan 6 card framework: svCard() chrome factory, pure orderCards()
ordering helper with unit tests, three stub card modules (clock/weather/host-perf),
and rewrites sacred_valley.js with the two-band layout that mounts ordered cards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 22:26:09 +10:00

20 lines
850 B
JavaScript

import { describe, it, expect } from 'vitest';
import { orderCards } from '../../public/views/cards/registry.js';
const defs = [{ id: 'clock' }, { id: 'weather' }, { id: 'host-perf' }];
describe('orderCards', () => {
it('uses saved order first, then appends new cards in default order', () => {
const out = orderCards(defs, { card_order: ['weather'], hidden: [] });
expect(out.map(c => c.id)).toEqual(['weather', 'clock', 'host-perf']);
});
it('drops hidden cards', () => {
const out = orderCards(defs, { card_order: [], hidden: ['clock'] });
expect(out.map(c => c.id)).toEqual(['weather', 'host-perf']);
});
it('ignores stale ids in saved order', () => {
const out = orderCards(defs, { card_order: ['gone', 'clock'], hidden: [] });
expect(out.map(c => c.id)).toEqual(['clock', 'weather', 'host-perf']);
});
});