Files
dsh-web/web/src/fileEditor.test.ts
T

21 lines
1010 B
TypeScript

import { expect, it } from 'vitest';
import { fileLanguage, maxTextBytes } from './fileEditor';
it('sets the text limit to exactly one MiB', () => {
expect(maxTextBytes).toBe(1024 * 1024);
});
it.each([
['nested/CONFIG.YAML', 'yaml'], ['config.yml', 'yaml'],
['settings.jsonc', 'json'], ['app.tsx', 'typescript'], ['app.mjs', 'javascript'],
['README.md', 'markdown'], ['script.sh', 'shell'], ['main.py', 'python'],
['main.go', 'go'], ['main.rs', 'rust'], ['index.html', 'html'],
['theme.css', 'css'], ['theme.scss', 'scss'], ['data.xml', 'xml'],
['schema.sql', 'sql'], ['settings.toml', 'ini'], ['service.conf', 'ini'],
['Main.java', 'java'], ['main.c', 'c'], ['include.h', 'c'], ['main.cpp', 'cpp'],
['build/Dockerfile', 'dockerfile'], ['secrets/.env', 'ini'], ['secrets/.env.local', 'ini'],
['README', 'plaintext'], ['data.unknown', 'plaintext'], ['folder.yaml/plain', 'plaintext'],
])('selects a language for %s', (path, language) => {
expect(fileLanguage(path)).toBe(language);
});