definma-ui/src/app/app.component.spec.ts

46 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-05-22 09:36:50 +02:00
import {TestBed, async, ComponentFixture} from '@angular/core/testing';
2020-01-14 13:41:28 +01:00
import { AppComponent } from './app.component';
2020-05-22 09:36:50 +02:00
import {By} from '@angular/platform-browser';
import {RbUiComponentsModule} from '@inst-iot/bosch-angular-ui-components';
import {RouterTestingModule} from '@angular/router/testing';
2020-01-14 13:41:28 +01:00
describe('AppComponent', () => {
2020-05-22 09:36:50 +02:00
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;
let css; // get native element by css selector
2020-01-14 13:41:28 +01:00
beforeEach(async(() => {
TestBed.configureTestingModule({
2020-05-22 09:36:50 +02:00
declarations: [ AppComponent ],
2020-01-14 13:41:28 +01:00
imports: [
2020-05-22 09:36:50 +02:00
RbUiComponentsModule,
2020-01-14 13:41:28 +01:00
RouterTestingModule
2020-05-22 09:36:50 +02:00
]
2020-01-14 13:41:28 +01:00
}).compileComponents();
}));
2020-05-22 09:36:50 +02:00
beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
fixture.detectChanges();
css = (selector) => fixture.debugElement.query(By.css(selector)).nativeElement;
});
2020-01-14 13:41:28 +01:00
it('should create the app', () => {
2020-05-22 09:36:50 +02:00
expect(component).toBeTruthy();
});
it('should have the header', () => {
expect(css('rb-full-header')).toBeTruthy();
});
it('should have the correct app title', () => {
expect(css('rb-full-header div.sub-brand-content > div').innerText).toBe('Digital Fingerprint of Plastics');
2020-01-14 13:41:28 +01:00
});
2020-05-22 09:36:50 +02:00
it('should have the page container', () => {
expect(css('.container')).toBeTruthy();
2020-01-14 13:41:28 +01:00
});
2020-05-22 09:36:50 +02:00
2020-01-14 13:41:28 +01:00
});