Trying to get the tests to pass, but still more work to do.
This commit is contained in:
parent
3b80d8dd89
commit
262dd0f198
|
@ -49,7 +49,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
|
|||
import { MatNativeDateModule, DateAdapter } from '@angular/material/core';
|
||||
import {MatPaginatorModule} from '@angular/material/paginator';
|
||||
import { CustomDateAdapter } from './custom-date-adapter';
|
||||
import { MatTableModule } from '@angular/material/table'
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import {MatGridListModule} from '@angular/material/grid-list';
|
||||
import {MatDividerModule} from '@angular/material/divider';
|
||||
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
|
@ -130,7 +130,7 @@ export function getBaseHref(platformLocation: PlatformLocation): string {
|
|||
ApiService,
|
||||
GraphService,
|
||||
CacheService,
|
||||
SettingsService,
|
||||
SettingsService,
|
||||
MatDatepickerModule,
|
||||
{provide: DateAdapter, useClass: CustomDateAdapter },
|
||||
{provide: 'APP_ENVIRONMENT', useClass: ThisEnvironment},
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { NativeDateAdapter } from '@angular/material/core';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
|
||||
/** Adapts the native JS Date for use with cdk-based components that work with dates. */
|
||||
@Injectable()
|
||||
export class CustomDateAdapter extends NativeDateAdapter {
|
||||
|
||||
|
||||
getFirstDayOfWeek(): number {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GraphsComponent } from './graphs.component';
|
||||
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
|
||||
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {ApiService} from '../services/api.service';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
import {Router} from '@angular/router';
|
||||
import {MockEnvironment} from '../testing/environment.mock';
|
||||
import {DateAdapter} from '@angular/material/core';
|
||||
import {CustomDateAdapter} from '../custom-date-adapter';
|
||||
|
||||
describe('GraphsComponent', () => {
|
||||
let component: GraphsComponent;
|
||||
let fixture: ComponentFixture<GraphsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GraphsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
let httpMock: HttpTestingController;
|
||||
const mockEnvironment = new MockEnvironment();
|
||||
const mockRouter = {
|
||||
createUrlTree: jasmine.createSpy('createUrlTree'),
|
||||
navigate: jasmine.createSpy('navigate')
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MatBottomSheetModule,
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
providers: [
|
||||
ApiService,
|
||||
{provide: 'APP_ENVIRONMENT', useValue: mockEnvironment},
|
||||
{provide: APP_BASE_HREF, useValue: '/'},
|
||||
{provide: Router, useValue: mockRouter},
|
||||
{provide: Location, useValue: location},
|
||||
{provide: DateAdapter, useClass: CustomDateAdapter }
|
||||
]
|
||||
});
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
fixture = TestBed.createComponent(GraphsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
|
|
@ -1,13 +1,43 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GraphService } from './graph.service';
|
||||
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
|
||||
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {ApiService} from './api.service';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
import {Router} from '@angular/router';
|
||||
import {MockEnvironment} from '../testing/environment.mock';
|
||||
|
||||
describe('GraphService', () => {
|
||||
let httpMock: HttpTestingController;
|
||||
let location: Location;
|
||||
let service: GraphService;
|
||||
const mockEnvironment = new MockEnvironment();
|
||||
const mockRouter = {
|
||||
createUrlTree: jasmine.createSpy('createUrlTree'),
|
||||
navigate: jasmine.createSpy('navigate')
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MatBottomSheetModule,
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
providers: [
|
||||
ApiService,
|
||||
{provide: 'APP_ENVIRONMENT', useValue: mockEnvironment},
|
||||
{provide: APP_BASE_HREF, useValue: '/'},
|
||||
{provide: Router, useValue: mockRouter},
|
||||
{provide: Location, useValue: location},
|
||||
]
|
||||
});
|
||||
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
service = TestBed.inject(GraphService);
|
||||
location = TestBed.inject(Location);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
|
|
Loading…
Reference in New Issue