38
src/routing/appRoutes.test.ts
Normal file
38
src/routing/appRoutes.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { matchAppRoute } from './appRoutes';
|
||||
|
||||
describe('matchAppRoute', () => {
|
||||
it('routes the main app by default', () => {
|
||||
expect(matchAppRoute('/')).toEqual({
|
||||
kind: 'game',
|
||||
});
|
||||
});
|
||||
|
||||
it('routes item editor paths to the preset editor items tab', () => {
|
||||
expect(matchAppRoute('/item-editor/tools')).toEqual({
|
||||
kind: 'preset-editor',
|
||||
initialTab: 'items',
|
||||
});
|
||||
});
|
||||
|
||||
it('routes behavior editor paths to the functions tab', () => {
|
||||
expect(matchAppRoute('/behavior-editor')).toEqual({
|
||||
kind: 'preset-editor',
|
||||
initialTab: 'functions',
|
||||
});
|
||||
});
|
||||
|
||||
it('accepts nested preset editor paths with trailing slashes', () => {
|
||||
expect(matchAppRoute('/NPC-EDITOR/profiles/')).toEqual({
|
||||
kind: 'preset-editor',
|
||||
initialTab: 'npcs',
|
||||
});
|
||||
});
|
||||
|
||||
it('does not treat unrelated prefixes as preset editor routes', () => {
|
||||
expect(matchAppRoute('/npc-editorial')).toEqual({
|
||||
kind: 'game',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user