blob: cc0b2fc70f2243ba52e16e366ba2826c989828d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { TruncatePipe } from './truncate.pipe';
describe('TruncatePipe', () => {
const pipe = new TruncatePipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('should truncate string (1)', () => {
expect(pipe.transform('fsdfdsfs asdasd', 5, '')).toEqual('fsdfd');
});
it('should truncate string (2)', () => {
expect(pipe.transform('fsdfdsfs asdasd', 10, '...')).toEqual('fsdfdsf...');
});
it('should not truncate number', () => {
expect(pipe.transform(2, 6, '...')).toBe(2);
});
});
|