20 lines
581 B
TypeScript
20 lines
581 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { parseLocaleOutput, selectDetectedSystemLocale } from './profile.js';
|
|
|
|
describe('setup profile detection helpers', () => {
|
|
it('parses locale command output', () => {
|
|
expect(
|
|
parseLocaleOutput('LANG=sl_SI.UTF-8\nLC_TIME="sl_SI.UTF-8"\n'),
|
|
).toEqual({
|
|
LANG: 'sl_SI.UTF-8',
|
|
LC_TIME: 'sl_SI.UTF-8',
|
|
});
|
|
});
|
|
|
|
it('prefers the first non-neutral locale candidate', () => {
|
|
expect(
|
|
selectDetectedSystemLocale(['C', 'POSIX', 'sr_Cyrl_RS.UTF-8']),
|
|
).toBe('sr_Cyrl_RS.UTF-8');
|
|
});
|
|
});
|