From 14cb9fb0056ceecc358dfe9660461149ef2fffd3 Mon Sep 17 00:00:00 2001 From: dario-piotrowicz Date: Sat, 17 Sep 2022 22:56:23 +0100 Subject: [PATCH] test(docs-infra): add mocks for missing mat-icons (#47469) add mocks for missing mat-icons in order to reduce noise when running aio tests PR Close #47469 --- .../search/file-not-found-search.component.spec.ts | 8 +++++++- .../search-results/search-results.component.spec.ts | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/aio/src/app/custom-elements/search/file-not-found-search.component.spec.ts b/aio/src/app/custom-elements/search/file-not-found-search.component.spec.ts index 390bf67ba87..b0b1a6df7f1 100644 --- a/aio/src/app/custom-elements/search/file-not-found-search.component.spec.ts +++ b/aio/src/app/custom-elements/search/file-not-found-search.component.spec.ts @@ -7,7 +7,13 @@ import { SearchResults } from 'app/search/interfaces'; import { SearchResultsComponent } from 'app/shared/search-results/search-results.component'; import { SearchService } from 'app/search/search.service'; import { FileNotFoundSearchComponent } from './file-not-found-search.component'; +import { Component } from '@angular/core'; +@Component({ + selector: 'mat-icon', + template: '', +}) +class MockMatIcon {} describe('FileNotFoundSearchComponent', () => { let fixture: ComponentFixture; @@ -17,7 +23,7 @@ describe('FileNotFoundSearchComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ FileNotFoundSearchComponent, SearchResultsComponent ], + declarations: [ FileNotFoundSearchComponent, SearchResultsComponent, MockMatIcon ], providers: [ { provide: LocationService, useValue: new MockLocationService('base/initial-url?some-query') }, SearchService diff --git a/aio/src/app/shared/search-results/search-results.component.spec.ts b/aio/src/app/shared/search-results/search-results.component.spec.ts index c52c9f7ba17..93f6143ac1f 100644 --- a/aio/src/app/shared/search-results/search-results.component.spec.ts +++ b/aio/src/app/shared/search-results/search-results.component.spec.ts @@ -1,9 +1,15 @@ -import { DebugElement } from '@angular/core'; +import { Component, DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { SearchResult } from 'app/search/interfaces'; import { SearchResultsComponent } from './search-results.component'; +@Component({ + selector: 'mat-icon', + template: '', +}) +class MockMatIcon {} + describe('SearchResultsComponent', () => { let component: SearchResultsComponent; @@ -76,7 +82,7 @@ describe('SearchResultsComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ SearchResultsComponent ] + declarations: [ SearchResultsComponent, MockMatIcon ] }); });