From 2b68a78ec8a6ac3533d39e9dc3fdfb28e2c78f53 Mon Sep 17 00:00:00 2001 From: jliddev Date: Fri, 10 Sep 2021 15:16:48 -0500 Subject: [PATCH] Fix the tests --- .../options/about/about.component.spec.ts | 16 ++++---- .../options-addon-section.component.spec.ts | 8 ++-- .../options-app-section.component.spec.ts | 18 ++++----- .../options-wow-section.component.spec.ts | 18 ++++----- .../wow-client-options.component.spec.ts | 16 ++++---- .../wtf-explorer.component.spec.ts | 37 ++++++++++++++++--- 6 files changed, 69 insertions(+), 44 deletions(-) diff --git a/wowup-electron/src/app/components/options/about/about.component.spec.ts b/wowup-electron/src/app/components/options/about/about.component.spec.ts index 30b38600..e58af9f3 100644 --- a/wowup-electron/src/app/components/options/about/about.component.spec.ts +++ b/wowup-electron/src/app/components/options/about/about.component.spec.ts @@ -6,15 +6,15 @@ import { ComponentFixture, TestBed } from "@angular/core/testing"; import { NoopAnimationsModule } from "@angular/platform-browser/animations"; import { TranslateCompiler, TranslateLoader, TranslateModule } from "@ngx-translate/core"; -import { httpLoaderFactory } from "../../app.module"; -import { MatModule } from "../../mat-module"; -import { ElectronService } from "../../services"; -import { SessionService } from "../../services/session/session.service"; -import { PatchNotesService } from "../../services/wowup/patch-notes.service"; -import { WowUpService } from "../../services/wowup/wowup.service"; +import { httpLoaderFactory } from "../../../app.module"; +import { MatModule } from "../../../mat-module"; +import { ElectronService } from "../../../services"; +import { DialogFactory } from "../../../services/dialog/dialog.factory"; +import { LinkService } from "../../../services/links/link.service"; +import { SessionService } from "../../../services/session/session.service"; +import { PatchNotesService } from "../../../services/wowup/patch-notes.service"; +import { WowUpService } from "../../../services/wowup/wowup.service"; import { AboutComponent } from "./about.component"; -import { DialogFactory } from "../../services/dialog/dialog.factory"; -import { LinkService } from "../../services/links/link.service"; describe("AboutComponent", () => { let component: AboutComponent; diff --git a/wowup-electron/src/app/components/options/options-addon-section/options-addon-section.component.spec.ts b/wowup-electron/src/app/components/options/options-addon-section/options-addon-section.component.spec.ts index bc8ee494..d4460062 100644 --- a/wowup-electron/src/app/components/options/options-addon-section/options-addon-section.component.spec.ts +++ b/wowup-electron/src/app/components/options/options-addon-section/options-addon-section.component.spec.ts @@ -1,10 +1,10 @@ import { HttpClientModule } from "@angular/common/http"; import { ComponentFixture, TestBed } from "@angular/core/testing"; import { NoopAnimationsModule } from "@angular/platform-browser/animations"; -import { MatModule } from "../../mat-module"; -import { AddonService } from "../../services/addons/addon.service"; -import { WowUpService } from "../../services/wowup/wowup.service"; -import { createTranslateModule } from "../../utils/test.utils"; +import { MatModule } from "../../../mat-module"; +import { AddonService } from "../../../services/addons/addon.service"; +import { WowUpService } from "../../../services/wowup/wowup.service"; +import { createTranslateModule } from "../../../utils/test.utils"; import { OptionsAddonSectionComponent } from "./options-addon-section.component"; diff --git a/wowup-electron/src/app/components/options/options-app-section/options-app-section.component.spec.ts b/wowup-electron/src/app/components/options/options-app-section/options-app-section.component.spec.ts index 65a3a94d..0082ffdc 100644 --- a/wowup-electron/src/app/components/options/options-app-section/options-app-section.component.spec.ts +++ b/wowup-electron/src/app/components/options/options-app-section/options-app-section.component.spec.ts @@ -6,15 +6,15 @@ import { FormsModule } from "@angular/forms"; import { MatDialog } from "@angular/material/dialog"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import { MatModule } from "../../mat-module"; -import { ElectronService } from "../../services"; -import { AddonService } from "../../services/addons/addon.service"; -import { AnalyticsService } from "../../services/analytics/analytics.service"; -import { FileService } from "../../services/files/file.service"; -import { SessionService } from "../../services/session/session.service"; -import { WowUpService } from "../../services/wowup/wowup.service"; -import { ZoomService } from "../../services/zoom/zoom.service"; -import { createTranslateModule } from "../../utils/test.utils"; +import { MatModule } from "../../../mat-module"; +import { ElectronService } from "../../../services"; +import { AddonService } from "../../../services/addons/addon.service"; +import { AnalyticsService } from "../../../services/analytics/analytics.service"; +import { FileService } from "../../../services/files/file.service"; +import { SessionService } from "../../../services/session/session.service"; +import { WowUpService } from "../../../services/wowup/wowup.service"; +import { ZoomService } from "../../../services/zoom/zoom.service"; +import { createTranslateModule } from "../../../utils/test.utils"; import { OptionsAppSectionComponent } from "./options-app-section.component"; describe("OptionsAppSectionComponent", () => { diff --git a/wowup-electron/src/app/components/options/options-wow-section/options-wow-section.component.spec.ts b/wowup-electron/src/app/components/options/options-wow-section/options-wow-section.component.spec.ts index 1f69f4c8..343da36d 100644 --- a/wowup-electron/src/app/components/options/options-wow-section/options-wow-section.component.spec.ts +++ b/wowup-electron/src/app/components/options/options-wow-section/options-wow-section.component.spec.ts @@ -7,17 +7,17 @@ import { MatDialog, MatDialogModule } from "@angular/material/dialog"; import { NoopAnimationsModule } from "@angular/platform-browser/animations"; import { TranslateCompiler, TranslateLoader, TranslateModule } from "@ngx-translate/core"; -import { WowClientType } from "../../../common/warcraft/wow-client-type"; -import { AddonChannelType } from "../../../common/wowup/models"; -import { httpLoaderFactory } from "../../app.module"; -import { MatModule } from "../../mat-module"; -import { InstalledProduct } from "../../models/warcraft/installed-product"; -import { WowUpReleaseChannelType } from "../../models/wowup/wowup-release-channel-type"; -import { WarcraftService } from "../../services/warcraft/warcraft.service"; -import { WowUpService } from "../../services/wowup/wowup.service"; +import { WowClientType } from "../../../../common/warcraft/wow-client-type"; +import { AddonChannelType } from "../../../../common/wowup/models"; +import { httpLoaderFactory } from "../../../app.module"; +import { MatModule } from "../../../mat-module"; +import { InstalledProduct } from "../../../models/warcraft/installed-product"; +import { WowUpReleaseChannelType } from "../../../models/wowup/wowup-release-channel-type"; +import { WarcraftService } from "../../../services/warcraft/warcraft.service"; +import { WowUpService } from "../../../services/wowup/wowup.service"; import { WowClientOptionsComponent } from "../wow-client-options/wow-client-options.component"; import { OptionsWowSectionComponent } from "./options-wow-section.component"; -import { WarcraftInstallationService } from "../../services/warcraft/warcraft-installation.service"; +import { WarcraftInstallationService } from "../../../services/warcraft/warcraft-installation.service"; describe("OptionsWowSectionComponent", () => { let component: OptionsWowSectionComponent; diff --git a/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.spec.ts b/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.spec.ts index 30247d6c..0aaad842 100644 --- a/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.spec.ts +++ b/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.spec.ts @@ -6,16 +6,16 @@ import { MatDialog } from "@angular/material/dialog"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { TranslateCompiler, TranslateLoader, TranslateModule } from "@ngx-translate/core"; -import { httpLoaderFactory } from "../../app.module"; -import { MatModule } from "../../mat-module"; -import { WowClientType } from "../../../common/warcraft/wow-client-type"; +import { httpLoaderFactory } from "../../../app.module"; +import { MatModule } from "../../../mat-module"; +import { WowClientType } from "../../../../common/warcraft/wow-client-type"; import { WowClientOptionsComponent } from "./wow-client-options.component"; import { FormsModule } from "@angular/forms"; -import { overrideIconModule } from "../../tests/mock-mat-icon"; -import { WarcraftInstallationService } from "../../services/warcraft/warcraft-installation.service"; -import { WarcraftService } from "../../services/warcraft/warcraft.service"; -import { mockPreload } from "../../tests/test-helpers"; -import { SessionService } from "../../services/session/session.service"; +import { overrideIconModule } from "../../../tests/mock-mat-icon"; +import { WarcraftInstallationService } from "../../../services/warcraft/warcraft-installation.service"; +import { WarcraftService } from "../../../services/warcraft/warcraft.service"; +import { mockPreload } from "../../../tests/test-helpers"; +import { SessionService } from "../../../services/session/session.service"; import { BehaviorSubject, Observable } from "rxjs"; describe("WowClientOptionsComponent", () => { diff --git a/wowup-electron/src/app/components/options/wtf-explorer/wtf-explorer.component.spec.ts b/wowup-electron/src/app/components/options/wtf-explorer/wtf-explorer.component.spec.ts index 713d3fd6..7fcc0182 100644 --- a/wowup-electron/src/app/components/options/wtf-explorer/wtf-explorer.component.spec.ts +++ b/wowup-electron/src/app/components/options/wtf-explorer/wtf-explorer.component.spec.ts @@ -1,16 +1,41 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from "@angular/core/testing"; +import { ElectronService } from "../../../services"; +import { WarcraftInstallationService } from "../../../services/warcraft/warcraft-installation.service"; +import { WarcraftService } from "../../../services/warcraft/warcraft.service"; +import { WtfService } from "../../../services/wtf/wtf.service"; +import { getStandardImports } from "../../../tests/test-helpers"; -import { WtfExplorerComponent } from './wtf-explorer.component'; +import { WtfExplorerComponent } from "./wtf-explorer.component"; -describe('WtfExplorerComponent', () => { +describe("WtfExplorerComponent", () => { let component: WtfExplorerComponent; let fixture: ComponentFixture; + let electronService: ElectronService; + let warcraftService: WarcraftService; + let warcraftInstallationService: WarcraftInstallationService; + let wtfService: WtfService; beforeEach(async () => { + electronService = jasmine.createSpyObj("ElectronService", [""], {}); + warcraftService = jasmine.createSpyObj("WarcraftService", [""], {}); + warcraftInstallationService = jasmine.createSpyObj("WarcraftInstallationService", [""], {}); + wtfService = jasmine.createSpyObj("WtfService", [""], {}); + await TestBed.configureTestingModule({ - declarations: [ WtfExplorerComponent ] + declarations: [WtfExplorerComponent], + imports: [getStandardImports()], }) - .compileComponents(); + .overrideComponent(WtfExplorerComponent, { + set: { + providers: [ + { provide: ElectronService, useValue: electronService }, + { provide: WarcraftService, useValue: warcraftService }, + { provide: WarcraftInstallationService, useValue: warcraftInstallationService }, + { provide: WtfService, useValue: wtfService }, + ], + }, + }) + .compileComponents(); }); beforeEach(() => { @@ -19,7 +44,7 @@ describe('WtfExplorerComponent', () => { fixture.detectChanges(); }); - it('should create', () => { + it("should create", () => { expect(component).toBeTruthy(); }); });