Files
electric-cherry/tests/unit/server-sections.test.ts
T

20 lines
990 B
TypeScript

import { describe, expect, it } from 'vitest';
import { serverSection, serverSectionAnchor } from '../../src/lib/server-sections.js';
describe('server detail bookmarks', () => {
it.each([
['scoreboard', 'live', null], ['chat', 'live', 'chat'], ['matches', 'matches', null],
['config', 'configuration', null], ['inventory', 'configuration', 'inventory'],
['logs', 'diagnostics', 'logs'], ['diagnostics', 'diagnostics', null], ['history', 'history', null]
])('preserves the destination of tab=%s', (tab, section, anchor) => {
expect(serverSection(tab)).toBe(section);
expect(serverSectionAnchor(tab)).toBe(anchor);
});
it('defaults unsupported tabs to Live and accepts the new sections', () => {
expect(serverSection(null)).toBe('live');
expect(serverSection('missing')).toBe('live');
expect(serverSection('live')).toBe('live');
expect(serverSection('configuration')).toBe('configuration');
});
});