mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
867 B
30 lines
867 B
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { FileSizePipe, KNumberPipe } from './numbers.pipes';
|
|
|
|
describe('FileSizePipe', () => {
|
|
it('should calculate correct human file size', () => {
|
|
const pipe = new FileSizePipe();
|
|
|
|
expect(pipe.transform(50)).toBe('50 B');
|
|
expect(pipe.transform(1024)).toBe('1.0 kB');
|
|
expect(pipe.transform(1260000)).toBe('1.2 MB');
|
|
});
|
|
});
|
|
|
|
describe('KNumberPipe', () => {
|
|
it('should calculate correct human string', () => {
|
|
const pipe = new KNumberPipe();
|
|
|
|
expect(pipe.transform(0)).toBe('0');
|
|
expect(pipe.transform(-1)).toBe('');
|
|
expect(pipe.transform(50)).toBe('50');
|
|
expect(pipe.transform(1024)).toBe('1k');
|
|
expect(pipe.transform(1260000)).toBe('1260k');
|
|
});
|
|
});
|