From d7f4aeb7d84547c2076ccfc2e697d842f8c3200e Mon Sep 17 00:00:00 2001 From: Piotr Pekala Date: Thu, 28 Feb 2019 02:09:40 -0800 Subject: [PATCH] Unit tests added --- .../custom-adapters.component.spec.ts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/app/components/preferences/common/custom-adapters/custom-adapters.component.spec.ts b/src/app/components/preferences/common/custom-adapters/custom-adapters.component.spec.ts index e69de29b..2ea2b4ca 100644 --- a/src/app/components/preferences/common/custom-adapters/custom-adapters.component.spec.ts +++ b/src/app/components/preferences/common/custom-adapters/custom-adapters.component.spec.ts @@ -0,0 +1,47 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule, MatTableModule } from '@angular/material'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { CommonModule } from '@angular/common'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { CustomAdaptersComponent } from './custom-adapters.component'; + +describe('Custom adapters component', () => { + let component: CustomAdaptersComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [MatTableModule, MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, CommonModule, NoopAnimationsModule], + declarations: [ + CustomAdaptersComponent + ], + schemas: [NO_ERRORS_SCHEMA] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CustomAdaptersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should emit event when apply clicked', () => { + spyOn(component.saveConfigurationEmitter, 'emit'); + + component.configureCustomAdapters(); + + expect(component.saveConfigurationEmitter.emit).toHaveBeenCalled(); + }); + + it('should emit event when cancel clicked', () => { + spyOn(component.closeConfiguratorEmitter, 'emit'); + + component.cancelConfigureCustomAdapters(); + + expect(component.closeConfiguratorEmitter.emit).toHaveBeenCalled(); + }); +});