Add imports and providers to enable basic testing
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChartComponent } from './chart.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
class MockService {
|
||||
getAll() {
|
||||
// unimplemented
|
||||
}
|
||||
};
|
||||
|
||||
describe('ChartComponent', () => {
|
||||
let component: ChartComponent;
|
||||
let fixture: ComponentFixture<ChartComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChartComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
imports: [HttpClientModule],
|
||||
providers: [ChartComponent]
|
||||
}).compileComponents();
|
||||
component = TestBed.inject(ChartComponent);
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ChartComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DonutChartComponent } from './donut-chart.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
describe('DonutChartComponent', () => {
|
||||
let component: DonutChartComponent;
|
||||
let fixture: ComponentFixture<DonutChartComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DonutChartComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
declarations: [DonutChartComponent],
|
||||
providers: [DonutChartComponent]
|
||||
}).compileComponents();
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DonutChartComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
component = TestBed.inject(DonutChartComponent);
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
|
||||
Reference in New Issue
Block a user