Skip to content

Commit

Permalink
fix missing mocks returning Promise in RoutngService.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Platonn committed Jun 18, 2021
1 parent 0c2235b commit f623bbc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MockAuthService implements Partial<AuthService> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockLaunchDialogService implements Partial<LaunchDialogService> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MockSavedCartFacade implements Partial<SavedCartFacade> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockGlobalMessageService implements Partial<GlobalMessageService> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MockSavedCartFacade implements Partial<SavedCartFacade> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}
class MockGlobalMessageService implements Partial<GlobalMessageService> {
add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MockTranslationService {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

describe('SavedCartListComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MockLaunchDialogService implements Partial<LaunchDialogService> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockSavedCartFacade implements Partial<SavedCartFacade> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MockUrlPipe implements PipeTransform {
}

class MockRoutingService implements Partial<RoutingService> {
go() {}
go = () => Promise.resolve(true);
}

let component: ConfigureProductComponent;
Expand Down
28 changes: 11 additions & 17 deletions feature-libs/storefinder/core/facade/store-finder.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
import { inject, TestBed } from '@angular/core/testing';
import * as NgrxStore from '@ngrx/store';
import { MemoizedSelector, Store, StoreModule } from '@ngrx/store';
import { StoreFinderActions } from '../store/actions/index';
import * as fromStoreReducers from '../store/reducers/index';
import {
FindStoresState,
StoresState,
StateWithStoreFinder,
STORE_FINDER_FEATURE,
} from '../store/store-finder-state';
import { StoreFinderService } from './store-finder.service';
import { NavigationExtras } from '@angular/router';
import { StoreFinderConfig } from '../config/store-finder-config';
import {
GeoPoint,
GlobalMessageService,
PointOfService,
RoutingService,
UrlCommands,
WindowRef,
} from '@spartacus/core';
import { BehaviorSubject, EMPTY, of } from 'rxjs';
import { StoreFinderConfig } from '../config/store-finder-config';
import { StoreFinderSelectors } from '../store';
import { StoreFinderActions } from '../store/actions/index';
import * as fromStoreReducers from '../store/reducers/index';
import {
FindStoresState,
StateWithStoreFinder,
StoresState,
STORE_FINDER_FEATURE,
} from '../store/store-finder-state';
import { StoreFinderService } from './store-finder.service';

const routerParam$: BehaviorSubject<{
[key: string]: string;
}> = new BehaviorSubject({});

class MockRoutingService implements Partial<RoutingService> {
go(
_commands: any[] | UrlCommands,
_query?: object,
_extras?: NavigationExtras
): void {}
go = () => Promise.resolve(true);

getParams = () => routerParam$.asObservable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
RoutingService,
} from '@spartacus/core';
import { ICON_TYPE, ModalService } from '@spartacus/storefront';
import { UserProfileFacade } from '@spartacus/user/profile/root';
import { Observable, of, throwError } from 'rxjs';
import { CloseAccountModalComponent } from './close-account-modal.component';
import { UserProfileFacade } from '@spartacus/user/profile/root';
import createSpy = jasmine.createSpy;

class MockGlobalMessageService implements Partial<GlobalMessageService> {
Expand All @@ -31,7 +31,7 @@ class MockAuthService implements Partial<AuthService> {
}

class MockRoutingService implements Partial<RoutingService> {
go() {}
go = () => Promise.resolve(true);
}

@Component({
Expand Down

0 comments on commit f623bbc

Please sign in to comment.