Skip to content

Commit

Permalink
Add SharedTestModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Borzenko committed Jul 17, 2023
1 parent 6599716 commit 20071a4
Show file tree
Hide file tree
Showing 61 changed files with 228 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NgbPopoverModule, NgbRatingModule } from "@ng-bootstrap/ng-bootstrap";
import { DisplayTimeModule } from "src/app/components/display-time/display-time.module";
import { MatChipsModule } from "@angular/material/chips";
import { MatDividerModule } from "@angular/material/divider";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetsTabComponent", () => {
let component: DatasetsTabComponent;
Expand All @@ -26,6 +27,7 @@ describe("DatasetsTabComponent", () => {
MatChipsModule,
NgbPopoverModule,
MatDividerModule,
SharedTestModule,
],
providers: [DatasetApi],
declarations: [DatasetsTabComponent, DatasetListItemComponent],
Expand Down
7 changes: 7 additions & 0 deletions src/app/common/shared-test.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NgModule } from "@angular/core";
import { snapshotParamMapMock } from "./base-test.helpers.spec";

@NgModule({
providers: [snapshotParamMapMock],
})
export class SharedTestModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { emitClickOnElementByDataTestId } from "src/app/common/base-test.helpers
import { DisplayTimeModule } from "../display-time/display-time.module";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { AngularSvgIconModule } from "angular-svg-icon";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetListItemComponent", () => {
let component: DatasetListItemComponent;
Expand All @@ -28,6 +29,7 @@ describe("DatasetListItemComponent", () => {
DisplayTimeModule,
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import timekeeper from "timekeeper";

import { DisplayTimeComponent } from "./display-time.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DisplayTimeComponent", () => {
let component: DisplayTimeComponent;
Expand All @@ -24,6 +25,7 @@ describe("DisplayTimeComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DisplayTimeComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DisplayTimeComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { BlockHeaderComponent } from "./block-header.component";
import { Apollo } from "apollo-angular";
import { MatMenuModule } from "@angular/material/menu";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("BlockHeaderComponent", () => {
let component: BlockHeaderComponent;
Expand All @@ -14,7 +15,12 @@ describe("BlockHeaderComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [BlockHeaderComponent],
imports: [MatMenuModule, MatIconModule, MatDividerModule],
imports: [
MatMenuModule,
MatIconModule,
MatDividerModule,
SharedTestModule,
],
providers: [Apollo, DatasetApi],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { HttpClientTestingModule } from "@angular/common/http/testing";
import { TooltipIconComponent } from "../../../tooltip-icon/tooltip-icon.component";
import { MatIconModule } from "@angular/material/icon";
import { NgbTooltipModule } from "@ng-bootstrap/ng-bootstrap";
import { snapshotParamMapMock } from "src/app/common/base-test.helpers.spec";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("AddDataEventComponent", () => {
let component: AddDataEventComponent;
Expand All @@ -37,7 +37,6 @@ describe("AddDataEventComponent", () => {
BlockRowDataComponent,
TooltipIconComponent,
],
providers: [snapshotParamMapMock],
imports: [
DisplaySizeModule,
ApolloModule,
Expand All @@ -46,6 +45,7 @@ describe("AddDataEventComponent", () => {
ToastrModule.forRoot(),
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
})
.overrideComponent(AddDataEventComponent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DisplayHashModule } from "src/app/components/display-hash/dispaly-hash.
import { ToastrModule } from "ngx-toastr";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { AngularSvgIconModule } from "angular-svg-icon";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("BlockIntervalPropertyComponent", () => {
let component: BlockIntervalPropertyComponent;
Expand All @@ -23,6 +24,7 @@ describe("BlockIntervalPropertyComponent", () => {
ToastrModule.forRoot(),
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CachePropertyComponent } from "./cache-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("CachePropertyComponent", () => {
let component: CachePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("CachePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CachePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(CachePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CardsPropertyComponent } from "./cards-property.component";
import { ActivatedRoute } from "@angular/router";

describe("CardsPropertyComponent", () => {
let component: CardsPropertyComponent;
Expand All @@ -9,6 +10,25 @@ describe("CardsPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CardsPropertyComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
paramMap: {
get: (key: string) => {
switch (key) {
case "accountName":
return "accountName";
case "datasetName":
return "datasetName";
}
},
},
},
},
},
],
}).compileComponents();

fixture = TestBed.createComponent(CardsPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CommandPropertyComponent } from "./command-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("CommandPropertyComponent", () => {
let component: CommandPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("CommandPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CommandPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(CommandPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DatasetNameByIdPropertyComponent } from "./dataset-name-by-id-property.
import { of } from "rxjs";
import { DatasetService } from "src/app/dataset-view/dataset.service";
import { mockDatasetMainDataResponse } from "src/app/search/mock.data";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetIdAndNamePropertyComponent", () => {
let component: DatasetNameByIdPropertyComponent;
Expand All @@ -20,7 +21,7 @@ describe("DatasetIdAndNamePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DatasetNameByIdPropertyComponent],
imports: [ApolloTestingModule],
imports: [ApolloTestingModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DatasetNameByIdPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NavigationService } from "./../../../../../../../services/navigation.se
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { DatasetNamePropertyComponent } from "./dataset-name-property.component";
import { DatasetViewTypeEnum } from "src/app/dataset-view/dataset-view.interface";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetNamePropertyComponent", () => {
let component: DatasetNamePropertyComponent;
Expand All @@ -11,6 +12,7 @@ describe("DatasetNamePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DatasetNamePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DatasetNamePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { EnginePropertyComponent } from "./engine-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EnginePropertyComponent", () => {
let component: EnginePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("EnginePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EnginePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EnginePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { EnvVariablesPropertyComponent } from "./env-variables-property.component";
import { DynamicTableComponent } from "src/app/components/dynamic-table/dynamic-table.component";
import { MatTableModule } from "@angular/material/table";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EnvVariablesPropertyComponent", () => {
let component: EnvVariablesPropertyComponent;
Expand All @@ -13,7 +14,7 @@ describe("EnvVariablesPropertyComponent", () => {
EnvVariablesPropertyComponent,
DynamicTableComponent,
],
imports: [MatTableModule],
imports: [MatTableModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EnvVariablesPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { EventTimePropertyComponent } from "./event-time-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EventTimePropertyComponent", () => {
let component: EventTimePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("EventTimePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EventTimePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EventTimePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { HashPropertyComponent } from "./hash-property.component";
import { DisplayHashModule } from "src/app/components/display-hash/dispaly-hash.module";
import { ToastrModule } from "ngx-toastr";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("HashPropertyComponent", () => {
let component: HashPropertyComponent;
Expand All @@ -10,7 +11,11 @@ describe("HashPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HashPropertyComponent],
imports: [DisplayHashModule, ToastrModule.forRoot()],
imports: [
DisplayHashModule,
ToastrModule.forRoot(),
SharedTestModule,
],
}).compileComponents();

fixture = TestBed.createComponent(HashPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { LinkPropertyComponent } from "./link-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("LinkPropertyComponent", () => {
let component: LinkPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("LinkPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [LinkPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(LinkPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { MergeStrategyPropertyComponent } from "./merge-strategy-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("MergeStrategyPropertyComponent", () => {
let component: MergeStrategyPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("MergeStrategyPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MergeStrategyPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(MergeStrategyPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DatasetService } from "src/app/dataset-view/dataset.service";
import { NavigationService } from "src/app/services/navigation.service";
import { of } from "rxjs";
import { mockDatasetMainDataResponse } from "src/app/search/mock.data";
import { snapshotParamMapMock } from "src/app/common/base-test.helpers.spec";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("OffsetIntervalPropertyComponent", () => {
let component: OffsetIntervalPropertyComponent;
Expand All @@ -16,8 +16,7 @@ describe("OffsetIntervalPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [OffsetIntervalPropertyComponent],
imports: [ApolloTestingModule],
providers: [snapshotParamMapMock],
imports: [ApolloTestingModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(OffsetIntervalPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { OrderPropertyComponent } from "./order-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("OrderPropertyComponent", () => {
let component: OrderPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("OrderPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [OrderPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(OrderPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { NavigationService } from "src/app/services/navigation.service";

import { OwnerPropertyComponent } from "./owner-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("OwnerPropertyComponent", () => {
let component: OwnerPropertyComponent;
Expand All @@ -11,6 +11,7 @@ describe("OwnerPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [OwnerPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(OwnerPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { SchemaPropertyComponent } from "./schema-property.component";
import { DynamicTableComponent } from "src/app/components/dynamic-table/dynamic-table.component";
import { MatTableModule } from "@angular/material/table";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("SchemaPropertyComponent", () => {
let component: SchemaPropertyComponent;
Expand All @@ -10,7 +11,7 @@ describe("SchemaPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SchemaPropertyComponent, DynamicTableComponent],
imports: [MatTableModule],
imports: [MatTableModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(SchemaPropertyComponent);
Expand Down
Loading

0 comments on commit 20071a4

Please sign in to comment.