-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathlanguages.test.mjs
More file actions
27 lines (22 loc) · 952 Bytes
/
languages.test.mjs
File metadata and controls
27 lines (22 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import assert from 'node:assert/strict';
import { it, describe } from 'node:test';
import { getLanguageDisplayName, LANGUAGES } from '../languages.mjs';
LANGUAGES.splice(
0,
LANGUAGES.length,
{ name: 'javascript', aliases: ['js'], displayName: 'JavaScript' },
{ name: 'typescript', aliases: ['ts'], displayName: 'TypeScript' }
);
describe('getLanguageDisplayName', async () => {
it('should return the display name for a known language', () => {
assert.equal(getLanguageDisplayName('javascript'), 'JavaScript');
assert.equal(getLanguageDisplayName('js'), 'JavaScript');
});
it('should return the display name for another known language', () => {
assert.equal(getLanguageDisplayName('typescript'), 'TypeScript');
assert.equal(getLanguageDisplayName('ts'), 'TypeScript');
});
it('should return the input language if it is not known', () => {
assert.equal(getLanguageDisplayName('unknown'), 'unknown');
});
});