16 lines
742 B
JavaScript
16 lines
742 B
JavaScript
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
import { JSDOM } from 'jsdom';
|
|
|
|
let current;
|
|
beforeAll(async () => {
|
|
const dom = new JSDOM('<!doctype html>', { url: 'http://localhost/#/' });
|
|
global.window = dom.window; global.document = dom.window.document; global.location = dom.window.location;
|
|
({ current } = await import('../../public/router.js'));
|
|
});
|
|
afterAll(() => { delete global.window; delete global.document; delete global.location; });
|
|
|
|
describe('router app routes', () => {
|
|
it('resolves #/timelapse', () => { location.hash = '#/timelapse'; expect(current().name).toBe('timelapse'); });
|
|
it('resolves #/ai-usage', () => { location.hash = '#/ai-usage'; expect(current().name).toBe('ai-usage'); });
|
|
});
|