2020-06-19 08:43:22 +02:00
|
|
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
|
|
|
|
|
|
import { ErrorComponent } from './error.component';
|
|
|
|
import {ModalService, RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
|
|
|
|
import {By} from '@angular/platform-browser';
|
|
|
|
|
2020-08-16 20:01:56 +02:00
|
|
|
// TODO
|
|
|
|
|
2020-06-19 08:43:22 +02:00
|
|
|
describe('ErrorComponent', () => {
|
|
|
|
let component: ErrorComponent;
|
|
|
|
let fixture: ComponentFixture<ErrorComponent>;
|
|
|
|
let css; // get native element by css selector
|
|
|
|
|
|
|
|
beforeEach(async(() => {
|
|
|
|
TestBed.configureTestingModule({
|
|
|
|
declarations: [ ErrorComponent ],
|
|
|
|
imports: [
|
|
|
|
RbUiComponentsModule,
|
|
|
|
],
|
|
|
|
providers: [
|
|
|
|
ModalService
|
|
|
|
]
|
|
|
|
})
|
|
|
|
.compileComponents();
|
|
|
|
}));
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
fixture = TestBed.createComponent(ErrorComponent);
|
|
|
|
component = fixture.componentInstance;
|
2020-08-16 20:01:56 +02:00
|
|
|
component.ngOnInit();
|
2020-06-19 08:43:22 +02:00
|
|
|
fixture.detectChanges();
|
|
|
|
css = (selector) => fixture.debugElement.query(By.css(selector)).nativeElement;
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create', () => {
|
|
|
|
expect(component).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show the alert', () => {
|
|
|
|
expect(css('rb-alert')).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have the right message', () => {
|
|
|
|
component.message = 'test';
|
|
|
|
fixture.detectChanges();
|
|
|
|
expect(css('.dialog-text').innerText).toBe('test');
|
|
|
|
});
|
|
|
|
});
|