merge from ecomp a88f0072 - Modern UI
[vid.git] / vid-webpack-master / src / app / shared / pipes / highlight / highlight-filter.pipe.spec.ts
1
2 import {HighlightPipe} from "./highlight-filter.pipe";
3 import {TestBed} from "@angular/core/testing";
4
5 describe('Highlight Pipe', () => {
6   let highlightPipe: HighlightPipe;
7
8   beforeAll(done => (async () => {
9     TestBed.configureTestingModule({});
10     await TestBed.compileComponents();
11
12     highlightPipe = new HighlightPipe();
13
14   })().then(done).catch(done.fail));
15
16   test('Highlight Pipe should be defined', () => {
17     expect(highlightPipe).toBeDefined();
18   });
19
20   test('Highlight Pipe should return "HTML" with highlight class if match exist', () => {
21     let result : string = highlightPipe.transform('Hello World', 'Wor');
22     expect(result).toEqual('Hello <span class="highlight">Wor</span>ld');
23   });
24
25   test('Highlight Pipe should not return "HTML" with highlight class if no match exist', () => {
26     let result : string = highlightPipe.transform('Hello World', 'ABC');
27     expect(result).toEqual('Hello World');
28   });
29 });