| /******************************************************************************** |
| * Copyright (c) 2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ********************************************************************************/ |
| import { async } from '@angular/core/testing'; |
| import { VersionInfoSandbox } from '@grid-failure-information-app/shared/components/version-info/version-info.sandbox'; |
| import { Store, ActionsSubject } from '@ngrx/store'; |
| import { State } from '@grid-failure-information-app/shared/store'; |
| import { of } from 'rxjs'; |
| import * as settingsActions from '@grid-failure-information-app/shared/store/actions/settings.action'; |
| |
| describe('VersionInfoSandbox', () => { |
| let sandbox: VersionInfoSandbox; |
| let appState: Store<State>; |
| let actionSubject: ActionsSubject; |
| let dispatchSpy: any; |
| |
| beforeEach(() => { |
| // Fakes (Mocking) |
| appState = { |
| dispatch: () => {}, |
| pipe: () => of(true), |
| select: () => of(true), |
| } as any; |
| actionSubject = { |
| pipe: () => of(true), |
| map: () => ({}), |
| } as any; |
| dispatchSpy = spyOn(appState, 'dispatch').and.callFake(() => {}); |
| |
| sandbox = new VersionInfoSandbox(appState, actionSubject); |
| }); |
| |
| it('should create', () => { |
| expect(sandbox).toBeTruthy(); |
| }); |
| |
| it('should dispatch getAppVerion() from setupAppVersion()', () => { |
| sandbox.setupAppVersion(); |
| expect(appState.dispatch).toHaveBeenCalledWith(settingsActions.getAppVersion()); |
| }); |
| }); |