feat(router): add #/timelapse and #/ai-usage routes
This commit is contained in:
@@ -24,6 +24,8 @@ const ROUTES = [
|
||||
{ name: 'yerin', re: /^\/(yerin|sentinel)$/, keys: [] },
|
||||
{ name: 'little-blue', re: /^\/little-blue$/, keys: [] },
|
||||
{ name: 'terminal', re: /^\/terminal$/, keys: [] },
|
||||
{ name: 'timelapse', re: /^\/timelapse$/, keys: [] },
|
||||
{ name: 'ai-usage', re: /^\/ai-usage$/, keys: [] },
|
||||
{ name: 'settings', re: /^\/settings$/, keys: [] },
|
||||
{ name: 'jobs', re: /^\/jobs$/, keys: [] },
|
||||
{ name: 'home', re: /^\/?$/, keys: [] }
|
||||
|
||||
15
tests/frontend/router.test.js
Normal file
15
tests/frontend/router.test.js
Normal file
@@ -0,0 +1,15 @@
|
||||
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'); });
|
||||
});
|
||||
Reference in New Issue
Block a user