File tree Expand file tree Collapse file tree
projects/pretty-html-log/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as prettyFixture from './pretty-fixture' ;
2+ import { prettyPrintFixture } from './pretty-fixture' ;
3+ import { DebugElement } from '@angular/core' ;
4+ import * as prettyHTMLLog from 'pretty-html-log' ;
5+ import { THEMES } from 'pretty-html-log' ;
6+ import { ComponentFixture } from '@angular/core/testing' ;
7+
8+ describe ( 'pretty fixture' , ( ) => {
9+ it ( 'should call prettyFixture with the componentFixture and pass it to console.log' , ( ) => {
10+ console . log = jest . fn ( ) ;
11+ const componentFixture = { } as ComponentFixture < any > ;
12+ spyOn ( prettyFixture , 'prettyFixture' ) ;
13+ prettyFixture . prettyPrintFixture ( componentFixture , THEMES . DRACULA ) ;
14+
15+ expect ( console . log ) . toHaveBeenCalledWith (
16+ prettyPrintFixture ( componentFixture , THEMES . DRACULA )
17+ ) ;
18+ } ) ;
19+
20+ it ( 'should call the highlight method with the innerHTML' , ( ) => {
21+ const innerHTML = '<h1>Foo</h1>' ;
22+ const componentFixture = {
23+ debugElement : {
24+ nativeElement : {
25+ innerHTML
26+ }
27+ }
28+ } as ComponentFixture < any > ;
29+ spyOn ( prettyHTMLLog , 'highlight' ) ;
30+
31+ prettyFixture . prettyFixture ( componentFixture , THEMES . DRACULA ) ;
32+ expect ( prettyHTMLLog . highlight ) . toHaveBeenCalledWith (
33+ innerHTML ,
34+ THEMES . DRACULA
35+ ) ;
36+ } ) ;
37+ } ) ;
You can’t perform that action at this time.
0 commit comments