Files
arboretum/packages/web/test/wt-key.test.ts
Johan LEROY 75efecf93f feat(p8): vue IDE /workspace (arbre + Monaco + diff + terminal)
- backend: garde-fou conflit d'édition par mtime (GET renvoie mtime, PUT refuse en 409 STALE_FILE si baseMtime périmé)
- lib: wt-key (base64url du chemin worktree), diff-parse (parseur pur du diff unifié → hunks)
- composables: useMonaco (import dynamique → chunk isolé), useWorkspaceLayout (largeurs/panneau persistés)
- components/workspace: GitStatusBadge, FileTree+FileTreeNode (lazy fs/list includeFiles), ChangedFilesPanel, DiffViewer (coloration +/-), MonacoEditor (Ctrl+S + bannière conflit reload/overwrite)
- views/WorkspaceView: 3 colonnes desktop redimensionnables + SegmentedControl mobile, header live (GitStatusBadge), watchWorktree → refresh diff/changements, terminal de la session corrélée
- router meta 'ide' + route /workspace/:repoId/:wt ; App.vue plein écran sans AppShell ; WorktreeCard bouton « Ouvrir l'IDE »
- deps: monaco-editor (lazy, vendor-monaco isolé, 0 impact bundle initial) ; vite manualChunks
- i18n EN+FR (workspace/editor/diff/git) ; tests diff-parse + wt-key ; acceptance-p8.mjs (mtime/409 + diff)
2026-06-27 13:47:10 +02:00

25 lines
734 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest';
import { encodeWtKey, decodeWtKey } from '../src/lib/wt-key';
describe('wt-key (base64url)', () => {
const paths = [
'/home/johan/WebstormProjects/arboretum',
'/srv/code/feature-branch',
'/tmp/with space/and-dash',
'/projets/accentué/café/é',
'/a/b/c/d/e/f/g',
];
it('round-trip encode → decode pour divers chemins', () => {
for (const p of paths) expect(decodeWtKey(encodeWtKey(p))).toBe(p);
});
it('produit un segment dURL sûr (pas de + / =)', () => {
for (const p of paths) {
const key = encodeWtKey(p);
expect(key).not.toMatch(/[+/=]/);
expect(encodeURIComponent(key)).toBe(key); // déjà URL-safe
}
});
});