gabriel / musehub public
lang-detect.test.ts typescript
33 lines 1.8 KB
Raw
sha256:0032d6cfa33bc3c8367436ad768e7dd0e339b4332153160247da8266cb5fa352 Merge branch 'task/version-tags-phase3-server' into dev Human 17 days ago
1 import { describe, it, expect } from 'vitest';
2 import { extToLang } from './lang-detect.ts';
3
4 describe('extToLang', () => {
5 // Standard extensions
6 it('detects python', () => expect(extToLang('main.py')).toBe('python'));
7 it('detects typescript', () => expect(extToLang('app.ts')).toBe('typescript'));
8 it('detects bash by .sh', () => expect(extToLang('install.sh')).toBe('bash'));
9 it('detects toml by extension', () => expect(extToLang('pyproject.toml')).toBe('toml'));
10 it('detects yaml', () => expect(extToLang('config.yml')).toBe('yaml'));
11 it('detects json', () => expect(extToLang('data.json')).toBe('json'));
12 it('detects markdown', () => expect(extToLang('README.md')).toBe('markdown'));
13
14 // Dotfiles (no extension)
15 it('detects .museattributes as toml', () => expect(extToLang('.museattributes')).toBe('toml'));
16 it('detects .museignore as toml', () => expect(extToLang('.museignore')).toBe('toml'));
17
18 // Dotfiles in nested paths
19 it('detects nested .museattributes as toml', () => expect(extToLang('subdir/.museattributes')).toBe('toml'));
20 it('detects .muse/code_config.toml as toml', () => expect(extToLang('.muse/code_config.toml')).toBe('toml'));
21
22 // bats
23 it('detects .bats as bash', () => expect(extToLang('tests/test_plugin.bats')).toBe('bash'));
24
25 // Zsh completion files — _<command> with no extension
26 it('detects _muse as bash', () => expect(extToLang('_muse')).toBe('bash'));
27 it('detects completions/_muse as bash', () => expect(extToLang('completions/_muse')).toBe('bash'));
28 it('detects _git as bash', () => expect(extToLang('_git')).toBe('bash'));
29
30 // Fallback
31 it('falls back to plaintext for unknown extension', () => expect(extToLang('data.bin')).toBe('plaintext'));
32 it('falls back to plaintext for unknown dotfile', () => expect(extToLang('.somethingelse')).toBe('plaintext'));
33 });
File History 10 commits
sha256:0032d6cfa33bc3c8367436ad768e7dd0e339b4332153160247da8266cb5fa352 Merge branch 'task/version-tags-phase3-server' into dev Human 17 days ago
sha256:4669620efda9ff41c55bdefd1f7bfe1c239d468428744c84ead9957e5a003a53 merge: rescue snapshot-recovery hardening (c00aa21d) into d… Opus 4.8 minor 29 days ago
sha256:a59da49c4611b970fc4b6ae48678ce4943261c213a07ddbd73ce9201df869b4a fix: remove false-positive proposal_comments index drop fro… Sonnet 4.6 patch 33 days ago
sha256:0a240d6dbff234f07d98a28a4a9a68db702f3f9ff9260196f24219bdb1c0b6f3 feat: render markdown mists as HTML with heading anchor links Sonnet 4.6 patch 34 days ago
sha256:24a7d47486ebc4ebd1832830580e177ec6f877b48dced8c000e198cdec4ce9d6 Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 35 days ago
sha256:b9ff931d147e0114a1f17060f415b89ed551c170a91ff226c70437aa5c85f9ee Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 35 days ago
sha256:d1122d21e73471879b460037b22c0b50fded7c423444a176f248428f75dac39c Merge 'task/fix-issue-pagination-cursor' into 'dev' — propo… Human 35 days ago
sha256:01e18975e73d2b3cd5b6db7929c895bef9aa6e0d4391dc5b2adfc548b41318dd Merge 'feat/adding-debug-logs-to-staging' into 'dev' — prop… Human 35 days ago
sha256:6b1949fc2797ca4c1936a637a4cbfec828ef56cf52398a2e74ca3c4f494e728f fix: use wire_bytes not mpack_bytes_raw in compute_object_b… Sonnet 4.6 patch 48 days ago
sha256:b99f2455dc346966d040133f5203297e6e3ef5803a93728a2c30568d0a0f7583 rename: delta_add → delta_upsert across wire format, models… Sonnet 4.6 patch 50 days ago