Skip to content

Commit

Permalink
Fix/UI watt tests (#64)
Browse files Browse the repository at this point in the history
* fix(button): add buttons as entrycomponents

* test: disable material sanity checks

* style: format

* revert: watt-button.module.spec.ts

* refactor(button): create testing module with entrycomponents

* style: format

* refactor(button): button testing module

* style: format

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 815fac8 commit 8996a09
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/dh-app/src/app/datahub-app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MATERIAL_SANITY_CHECKS } from '@angular/material/core';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterOutlet } from '@angular/router';
Expand All @@ -29,6 +30,8 @@ describe(DataHubAppComponent.name, () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [DataHubAppModule, NoopAnimationsModule, RouterTestingModule],
// https://github.com/thymikee/jest-preset-angular/issues/83
providers: [{ provide: MATERIAL_SANITY_CHECKS, useValue: false }],
}).compileComponents();
});

Expand Down
3 changes: 3 additions & 0 deletions apps/dh-app/src/app/datahub-app.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MATERIAL_SANITY_CHECKS } from '@angular/material/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
Expand All @@ -26,6 +27,8 @@ describe('Application smoke test', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [DataHubAppModule, NoopAnimationsModule, RouterTestingModule],
// https://github.com/thymikee/jest-preset-angular/issues/83
providers: [{ provide: MATERIAL_SANITY_CHECKS, useValue: false }],
}).compileComponents();

rootFixture = TestBed.createComponent(DataHubAppComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MATERIAL_SANITY_CHECKS } from '@angular/material/core';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
Expand All @@ -29,6 +30,8 @@ describe(ShellComponent.name, () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ShellModule, NoopAnimationsModule, RouterTestingModule],
// https://github.com/thymikee/jest-preset-angular/issues/83
providers: [{ provide: MATERIAL_SANITY_CHECKS, useValue: false }],
}).compileComponents();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MATERIAL_SANITY_CHECKS } from '@angular/material/core';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
Expand All @@ -26,6 +27,8 @@ describe(EttShellComponent.name, () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [EttShellScam, NoopAnimationsModule, RouterTestingModule],
// https://github.com/thymikee/jest-preset-angular/issues/83
providers: [{ provide: MATERIAL_SANITY_CHECKS, useValue: false }],
}).compileComponents();

fixture = TestBed.createComponent(EttShellComponent);
Expand Down
17 changes: 14 additions & 3 deletions libs/ui-watt/src/lib/components/button/watt-button.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component } from '@angular/core';
import { Component, NgModule } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { MATERIAL_SANITY_CHECKS } from '@angular/material/core';
import { WattPrimaryButtonComponent } from './primary-button/watt-primary-button.component';

import { WattButtonModule } from './watt-button.module';

Expand All @@ -26,9 +28,18 @@ describe(WattButtonModule.name, () => {
})
class TestHostComponent {}

TestBed.configureTestingModule({
declarations: [TestHostComponent],
@NgModule({
imports: [WattButtonModule],
declarations: [TestHostComponent],
// https://github.com/thymikee/jest-preset-angular/issues/83
providers: [{ provide: MATERIAL_SANITY_CHECKS, useValue: false }],
entryComponents: [WattPrimaryButtonComponent],
exports: [WattButtonModule],
})
class TestingModule {}

TestBed.configureTestingModule({
imports: [TestingModule],
});

const fixture = TestBed.createComponent(TestHostComponent);
Expand Down

0 comments on commit 8996a09

Please sign in to comment.