srumboard_frontend/src/app/components/dashboard/dashboard.component.spec.ts

36 lines
1.1 KiB
TypeScript

import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { BackendService } from '../../services/backend.service';
import { HttpClientModule } from '@angular/common/http';
import { DashboardComponent } from './dashboard.component';
describe('DashboardComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
HttpClientModule,
],
declarations: [
DashboardComponent,
],
providers: [
BackendService,
]
}).compileComponents();
}));
it('should create the component', () => {
const fixture = TestBed.createComponent(DashboardComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should parse dates correctly', () => {
const fixture = TestBed.createComponent(DashboardComponent);
const app = fixture.componentInstance;
expect(app.toDateString('2020-07-01T14:30:20')).toEqual('1.7.2020');
expect(app.toDateString('2020-11-23T07:30:20')).toEqual('23.11.2020');
});
});