@cnamts/vue-dot
Version:
Implementation of our Design System for the French Health Insurance
24 lines (18 loc) • 479 B
text/typescript
import { calcHumanFileSize } from '../';
const sizeMax = 4096 * 1024; // 4MB
const fileSizeUnits = [
'B',
'KB',
'MB',
'GB',
'TB'
];
describe('calcHumanFileSize', () => {
it('returns the readable size', () => {
expect(calcHumanFileSize(sizeMax, fileSizeUnits)).toEqual('4 MB');
});
it('returns the readable size with a custom text separator', () => {
const separator = '_';
expect(calcHumanFileSize(sizeMax, fileSizeUnits, separator)).toEqual('4_MB');
});
});