Add imports and providers to enable basic testing

This commit is contained in:
Jesse Lucas 2020-04-04 16:12:27 -04:00
parent 3ee9bc097f
commit 236816cb93
14 changed files with 76 additions and 75 deletions

View File

@ -19,17 +19,4 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'tech-ui'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('tech-ui');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('tech-ui app is running!');
});
});

View File

@ -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();
});

View File

@ -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();

View File

@ -7,7 +7,7 @@
<span>Tech UI</span>
</div>
</div>
<mat-progress-bar mode="determinate" value="20"></mat-progress-bar>
<mat-progress-bar mode="determinate" value="95.67"></mat-progress-bar>
<div fxLayout="column" fxLayoutGap="16px" class="grid-container" [@loading]="isLoading ? 'start' : 'done'">
<div fxLayout="row" fxLayoutGap="16px" fxLayoutAlign="space-between stretch">
<app-chart [type]=folderChart fxFlex="50"></app-chart>

View File

@ -1,13 +1,8 @@
import { LayoutModule } from '@angular/cdk/layout';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { DashboardComponent } from './dashboard.component';
import { HttpClientModule } from '@angular/common/http';
import { NoopAnimationsModule, BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('DashboardComponent', () => {
let component: DashboardComponent;
@ -17,15 +12,14 @@ describe('DashboardComponent', () => {
TestBed.configureTestingModule({
declarations: [DashboardComponent],
imports: [
HttpClientModule,
NoopAnimationsModule,
LayoutModule,
MatButtonModule,
MatCardModule,
MatGridListModule,
MatIconModule,
MatMenuModule,
]
BrowserAnimationsModule,
],
providers: [DashboardComponent]
}).compileComponents();
component = TestBed.inject(DashboardComponent);
}));
beforeEach(() => {

View File

@ -5,6 +5,8 @@ import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { DeviceListComponent } from './device-list.component';
import { HttpClientModule } from '@angular/common/http';
import { ChangeDetectorRef } from '@angular/core';
describe('DeviceListComponent', () => {
let component: DeviceListComponent;
@ -13,20 +15,12 @@ describe('DeviceListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DeviceListComponent],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
MatSortModule,
MatTableModule,
]
imports: [HttpClientModule],
providers: [DeviceListComponent, ChangeDetectorRef]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeviceListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
component = TestBed.inject(DeviceListComponent);
}));
it('should compile', () => {
expect(component).toBeTruthy();

View File

@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FolderListComponent } from './folder-list.component';
import { HttpClientModule } from '@angular/common/http';
import { ChangeDetectorRef } from '@angular/core';
describe('FolderListComponent', () => {
let component: FolderListComponent;
@ -8,16 +10,14 @@ describe('FolderListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FolderListComponent ]
declarations: [FolderListComponent],
imports: [HttpClientModule],
providers: [FolderListComponent, ChangeDetectorRef]
})
.compileComponents();
}));
.compileComponents();
beforeEach(() => {
fixture = TestBed.createComponent(FolderListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
component = TestBed.inject(FolderListComponent);
}));
it('should create', () => {
expect(component).toBeTruthy();

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DbCompletionService } from './db-completion.service';
import { HttpClientModule } from '@angular/common/http';
describe('DbCompletionService', () => {
let service: DbCompletionService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [DbCompletionService]
});
service = TestBed.inject(DbCompletionService);
});

View File

@ -1,11 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DbStatusService } from './db-status.service';
import { HttpClientModule } from '@angular/common/http';
describe('DbStatusService', () => {
let service: DbStatusService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [DbStatusService]
});
TestBed.configureTestingModule({});
service = TestBed.inject(DbStatusService);
});

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DeviceService } from './device.service';
import { HttpClientModule } from '@angular/common/http';
describe('DeviceService', () => {
let service: DeviceService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [DeviceService]
});
service = TestBed.inject(DeviceService);
});

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { FolderService } from './folder.service';
import { HttpClientModule } from '@angular/common/http';
describe('FolderService', () => {
let service: FolderService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [FolderService]
});
service = TestBed.inject(FolderService);
});

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { SystemConfigService } from './system-config.service';
import { HttpClientModule } from '@angular/common/http';
describe('SystemConfigService', () => {
let service: SystemConfigService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [SystemConfigService]
});
service = TestBed.inject(SystemConfigService);
});

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { SystemConnectionsService } from './system-connections.service';
import { HttpClientModule } from '@angular/common/http';
describe('SystemConnectionsService', () => {
let service: SystemConnectionsService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [SystemConnectionsService]
});
service = TestBed.inject(SystemConnectionsService);
});

View File

@ -1,12 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { SystemStatusService } from './system-status.service';
import { HttpClientModule } from '@angular/common/http';
describe('SystemStatusService', () => {
let service: SystemStatusService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [SystemStatusService]
});
service = TestBed.inject(SystemStatusService);
});