1- import { HttpClient , HttpHandler } from '@angular/common/http' ;
1+ import { HttpClientModule , HttpHandler } from '@angular/common/http' ;
22import { HttpClientTestingModule } from '@angular/common/http/testing' ;
33import { ComponentFixture , TestBed } from '@angular/core/testing' ;
44import { MatAutocomplete } from '@angular/material/autocomplete' ;
@@ -12,19 +12,35 @@ describe('MatrixComponent', () => {
1212
1313 beforeEach ( async ( ) => {
1414 await TestBed . configureTestingModule ( {
15- providers : [ ymlService , HttpClient , HttpHandler , HttpClientTestingModule ] ,
16- imports : [ RouterTestingModule ] ,
15+ providers : [ ymlService , HttpClientTestingModule ] ,
16+ imports : [ RouterTestingModule , HttpClientModule ] ,
1717 declarations : [ MatrixComponent , MatAutocomplete ] ,
1818 } ) . compileComponents ( ) ;
1919 } ) ;
2020
2121 beforeEach ( ( ) => {
2222 fixture = TestBed . createComponent ( MatrixComponent ) ;
2323 component = fixture . componentInstance ;
24+ component . ngOnInit ( ) ;
2425 fixture . detectChanges ( ) ;
2526 } ) ;
2627
2728 it ( 'should create' , ( ) => {
29+ fixture . detectChanges ( ) ;
2830 expect ( component ) . toBeTruthy ( ) ;
2931 } ) ;
32+
33+ it ( 'check for table generation' , ( ) => {
34+ const HTMLElement : HTMLElement = fixture . nativeElement ;
35+ const table = HTMLElement . querySelector ( 'table' ) ! ;
36+ expect ( table ) . toBeTruthy ( ) ;
37+ //expect(p.textContent).toEqual('banner works!');
38+ } ) ;
39+
40+ it ( 'check if all rows are being shown as chips' , ( ) => {
41+ var check = JSON . parse ( JSON . stringify ( component . MATRIX_DATA ) ) ;
42+ console . log ( check ) ;
43+ expect ( component . rowsCurrentlyBeingShown ) . toEqual ( component . allRows ) ;
44+ //expect(p.textContent).toEqual('banner works!');
45+ } ) ;
3046} ) ;
0 commit comments