Files
bDS/tests/renderer/navigation/editorRouting.test.ts
Georg Bauer b855d61524 Feature/post media translations (#42)
* chore: updated todo with translation ideas

* feat: first take at the implementation of translations

* fix: small addition for the translation feature

* feat: support language switching in the editor and preview

* feat: better handling of long bodies by not running them through a json envelope

* fix: unknown macros have better fallback

* feat: api for python to get translations

* fix: strip dumb prefix of content in translation

* feat: extend meta diff for translations

* feat: hook up translations to rebuild-from-disk

* feat: generation of the website prefers project language, falling back to canonical language

* fix: crashes during rendering

* feat: translation validation report

* fix: made the translation validation actually work

* chore: reorganization of menu

* fix: some topics cleanup

* chore: updated doc

* feat: translations for media

* feat: more aligned in UI/UX

* feat: edit translations possible

* chore: added full multi-language todo

* chore: updated todo for clarity

* feat: implementation of full multi-linguality

* fix: page creation creates pages

* fix: flags on every page

* fix: better prompt

* feat: made MCP server aware of language content

* feat: python tools for translations

* fix: better fill-in-translations

* fix: better prompt for translation. maybe.

* fix: losing posts from search due to translation process

* fix: translation validation handles in-db content and fill-in of missing translations fixed to flush

* fix: faster scanning for infilling of missing translations

* chore: updated agent instructions

* feat: calendar and tag cloud respect current language now

* fix: retries going up

* fix: got metadata-diff and rebuild into sync

* fix: extended meta-diff for timestamps

* fix: made website validation look at translated content, too

* fix: multi-lingual search

* chore: refactor Editor.tsx into two separate editors

* feat: do language detection when no explicit language given

---------

Co-authored-by: hugo <hugoms@me.com>
2026-03-09 14:43:18 +01:00

70 lines
2.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import type { Tab } from '../../../src/renderer/store/appStore';
import {
EDITOR_TAB_ROUTE_REGISTRY,
resolveEditorRoute,
} from '../../../src/renderer/navigation/editorRouting';
describe('editorRouting', () => {
it('defines canonical tab-type to editor-route mapping', () => {
expect(EDITOR_TAB_ROUTE_REGISTRY).toEqual({
post: 'post',
media: 'media',
settings: 'settings',
style: 'style',
tags: 'tags',
chat: 'chat',
import: 'import',
'menu-editor': 'menu-editor',
'metadata-diff': 'metadata-diff',
'git-diff': 'git-diff',
documentation: 'documentation',
'api-documentation': 'api-documentation',
'site-validation': 'site-validation',
'translation-validation': 'translation-validation',
scripts: 'scripts',
templates: 'templates',
'find-duplicates': 'find-duplicates',
});
});
it('resolves dashboard route when no active tab is present', () => {
expect(resolveEditorRoute(undefined)).toEqual({
route: 'dashboard',
tabId: null,
gitDiffResource: null,
});
});
it('resolves post and media routes with active tab id', () => {
const postTab: Tab = { type: 'post', id: 'post-1', isTransient: true };
const mediaTab: Tab = { type: 'media', id: 'media-1', isTransient: false };
expect(resolveEditorRoute(postTab)).toEqual({
route: 'post',
tabId: 'post-1',
gitDiffResource: null,
});
expect(resolveEditorRoute(mediaTab)).toEqual({
route: 'media',
tabId: 'media-1',
gitDiffResource: null,
});
});
it('resolves git-diff route and extracts resource from tab id', () => {
const tab: Tab = {
type: 'git-diff',
id: 'git-diff:commit:abc123',
isTransient: true,
};
expect(resolveEditorRoute(tab)).toEqual({
route: 'git-diff',
tabId: 'git-diff:commit:abc123',
gitDiffResource: 'commit:abc123',
});
});
});