diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index bc73cff60..18d12318b 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -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!'); - }); }); diff --git a/src/app/charts/chart/chart.component.spec.ts b/src/app/charts/chart/chart.component.spec.ts index 4bfa61135..87533587c 100644 --- a/src/app/charts/chart/chart.component.spec.ts +++ b/src/app/charts/chart/chart.component.spec.ts @@ -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; 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(); }); diff --git a/src/app/charts/donut-chart/donut-chart.component.spec.ts b/src/app/charts/donut-chart/donut-chart.component.spec.ts index 8c299a9ec..340cfd687 100644 --- a/src/app/charts/donut-chart/donut-chart.component.spec.ts +++ b/src/app/charts/donut-chart/donut-chart.component.spec.ts @@ -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; 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(); diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 9f5d68c2c..23d03d58e 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -7,7 +7,7 @@ Tech UI - +
diff --git a/src/app/dashboard/dashboard.component.spec.ts b/src/app/dashboard/dashboard.component.spec.ts index 980c24fd0..1ce2c37b2 100644 --- a/src/app/dashboard/dashboard.component.spec.ts +++ b/src/app/dashboard/dashboard.component.spec.ts @@ -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(() => { diff --git a/src/app/lists/device-list/device-list.component.spec.ts b/src/app/lists/device-list/device-list.component.spec.ts index 6a23078a8..7b45e3278 100644 --- a/src/app/lists/device-list/device-list.component.spec.ts +++ b/src/app/lists/device-list/device-list.component.spec.ts @@ -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(); diff --git a/src/app/lists/folder-list/folder-list.component.spec.ts b/src/app/lists/folder-list/folder-list.component.spec.ts index 225398c99..9fc88dcd3 100644 --- a/src/app/lists/folder-list/folder-list.component.spec.ts +++ b/src/app/lists/folder-list/folder-list.component.spec.ts @@ -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(); diff --git a/src/app/services/db-completion.service.spec.ts b/src/app/services/db-completion.service.spec.ts index 90b9a8ed8..e6a07d016 100644 --- a/src/app/services/db-completion.service.spec.ts +++ b/src/app/services/db-completion.service.spec.ts @@ -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); }); diff --git a/src/app/services/db-status.service.spec.ts b/src/app/services/db-status.service.spec.ts index d5d0a16c6..65c7c871c 100644 --- a/src/app/services/db-status.service.spec.ts +++ b/src/app/services/db-status.service.spec.ts @@ -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); }); diff --git a/src/app/services/device.service.spec.ts b/src/app/services/device.service.spec.ts index d55f5fb7d..35b94a052 100644 --- a/src/app/services/device.service.spec.ts +++ b/src/app/services/device.service.spec.ts @@ -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); }); diff --git a/src/app/services/folder.service.spec.ts b/src/app/services/folder.service.spec.ts index 591addf71..6382d4ac8 100644 --- a/src/app/services/folder.service.spec.ts +++ b/src/app/services/folder.service.spec.ts @@ -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); }); diff --git a/src/app/services/system-config.service.spec.ts b/src/app/services/system-config.service.spec.ts index 7f2beb10a..011706140 100644 --- a/src/app/services/system-config.service.spec.ts +++ b/src/app/services/system-config.service.spec.ts @@ -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); }); diff --git a/src/app/services/system-connections.service.spec.ts b/src/app/services/system-connections.service.spec.ts index bac82fabb..c55566e12 100644 --- a/src/app/services/system-connections.service.spec.ts +++ b/src/app/services/system-connections.service.spec.ts @@ -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); }); diff --git a/src/app/services/system-status.service.spec.ts b/src/app/services/system-status.service.spec.ts index 8b47a3a6a..a292daa68 100644 --- a/src/app/services/system-status.service.spec.ts +++ b/src/app/services/system-status.service.spec.ts @@ -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); });