19 lines
587 B
JavaScript
19 lines
587 B
JavaScript
|
import { formatBytes } from '../files';
|
||
|
|
||
|
describe('#File Helpers', () => {
|
||
|
describe('formatBytes', () => {
|
||
|
it('should return zero bytes if 0 is passed', () => {
|
||
|
expect(formatBytes(0)).toBe('0 Bytes');
|
||
|
});
|
||
|
it('should return in bytes if 1000 is passed', () => {
|
||
|
expect(formatBytes(1000)).toBe('1000 Bytes');
|
||
|
});
|
||
|
it('should return in KB if 100000 is passed', () => {
|
||
|
expect(formatBytes(10000)).toBe('9.77 KB');
|
||
|
});
|
||
|
it('should return in MB if 10000000 is passed', () => {
|
||
|
expect(formatBytes(10000000)).toBe('9.54 MB');
|
||
|
});
|
||
|
});
|
||
|
});
|