Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed May 29, 2024
1 parent 888d4de commit 9642cd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NgxsModule, Store } from "@ngxs/store";

import { ElevationProvider } from "./elevation.provider";
import { LoggingService } from "./logging.service";
import { DatabaseService } from "./database.service";
import { PmTilesService } from "./pmtiles.service";

describe("ElevationProvider", () => {

Expand All @@ -18,7 +18,7 @@ describe("ElevationProvider", () => {
],
providers: [
{ provide: LoggingService, useValue: { warning: () => { } } },
{ provide: DatabaseService, useValue: {} },
{ provide: PmTilesService, useValue: {} },
ElevationProvider
]
});
Expand Down Expand Up @@ -80,8 +80,8 @@ describe("ElevationProvider", () => {
));

it("Should update elevation when getting an error from server and offline is available",
inject([ElevationProvider, HttpTestingController, DatabaseService, Store],
async (elevationProvider: ElevationProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([ElevationProvider, HttpTestingController, PmTilesService, Store],
async (elevationProvider: ElevationProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {
const latlngs = [{ lat: 32, lng: 35, alt: 0 }];

store.reset({
Expand Down
24 changes: 10 additions & 14 deletions IsraelHiking.Web/src/application/services/routing.provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import { ResourcesService } from "./resources.service";
import { ToastService } from "./toast.service";
import { GeoJsonParser } from "./geojson.parser";
import { ToastServiceMockCreator } from "./toast.service.spec";
import { DatabaseService } from "./database.service";
import { LoggingService } from "./logging.service";
import { RunningContextService } from "./running-context.service";
import { SpatialService } from "./spatial.service";
import { PmTilesService } from "./pmtiles.service";
import { MBTilesService } from "./mbtiles.service";

const createTileFromFeatureCollection = (featureCollection: GeoJSON.FeatureCollection): ArrayBuffer => {
const tileindex = geojsonVt(featureCollection);
Expand Down Expand Up @@ -45,11 +43,9 @@ describe("RoutingProvider", () => {
providers: [
{ provide: ResourcesService, useValue: toastMockCreator.resourcesService },
{ provide: ToastService, useValue: toastMockCreator.toastService },
{ provide: DatabaseService, usevalue: {} },
{ provide: LoggingService, useValue: { error: () => {} } },
{ provide: RunningContextService, useValue: {} },
{ provide: PmTilesService, useValue: {} },
{ provide: MBTilesService, useValue: {} },
GeoJsonParser,
RoutingProvider,
]
Expand Down Expand Up @@ -175,8 +171,8 @@ describe("RoutingProvider", () => {
));

it("Should return a route when getting error response from server and offline is available",
inject([RoutingProvider, HttpTestingController, DatabaseService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([RoutingProvider, HttpTestingController, PmTilesService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {

const featureCollection = {
type: "FeatureCollection",
Expand Down Expand Up @@ -211,8 +207,8 @@ describe("RoutingProvider", () => {
));

it("Should return a route when getting error response from server and offline is available for a multiline string",
inject([RoutingProvider, HttpTestingController, DatabaseService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([RoutingProvider, HttpTestingController, PmTilesService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {

const featureCollection = {
type: "FeatureCollection",
Expand Down Expand Up @@ -250,8 +246,8 @@ describe("RoutingProvider", () => {
));

it("Should return a route when getting error response from server and offline is available only through one line",
inject([RoutingProvider, HttpTestingController, DatabaseService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([RoutingProvider, HttpTestingController, PmTilesService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {

const featureCollection = {
type: "FeatureCollection",
Expand Down Expand Up @@ -295,8 +291,8 @@ describe("RoutingProvider", () => {
));

it("Should return srart and end point when all lines are filtered out",
inject([RoutingProvider, HttpTestingController, DatabaseService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([RoutingProvider, HttpTestingController, PmTilesService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {

const featureCollection = {
type: "FeatureCollection",
Expand Down Expand Up @@ -331,8 +327,8 @@ describe("RoutingProvider", () => {
));

it("Should return a route between two lines when points are not exactly the same",
inject([RoutingProvider, HttpTestingController, DatabaseService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: DatabaseService, store: Store) => {
inject([RoutingProvider, HttpTestingController, PmTilesService, Store],
async (router: RoutingProvider, mockBackend: HttpTestingController, db: PmTilesService, store: Store) => {
const featureCollection = {
type: "FeatureCollection",
features: [{
Expand Down

0 comments on commit 9642cd7

Please sign in to comment.