mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-11-12 21:44:22 +08:00
21 lines
912 B
TypeScript
21 lines
912 B
TypeScript
import { describe, expect, it } from 'vitest';
|
||
import { formatSystemMetric } from './system-metrics';
|
||
|
||
describe('system metric presentation', () => {
|
||
it('formats live values and legacy concatenated English durations', () => {
|
||
expect(formatSystemMetric(50425, 'ru')).toBe('50\u00a0425');
|
||
expect(formatSystemMetric('28 minutes41 seconds', 'ru')).toBe(
|
||
'28 мин 41 с',
|
||
);
|
||
expect(formatSystemMetric('1 day 2 hours', 'ru')).toBe('1 дн. 2 ч');
|
||
expect(formatSystemMetric('28 minutes41 seconds', 'en')).toBe('28m 41s');
|
||
expect(formatSystemMetric('43 seconds', 'zh-CN')).toBe('43秒');
|
||
expect(formatSystemMetric('5.8 MiB', 'ru')).toBe('5,8 MiB');
|
||
expect(formatSystemMetric('0.001s', 'ru')).toBe('0,001 с');
|
||
expect(formatSystemMetric('None', 'ru')).toBe('Нет');
|
||
expect(formatSystemMetric('custom metric 42', 'ru')).toBe(
|
||
'custom metric 42',
|
||
);
|
||
});
|
||
});
|