From 471f8587567e0cba79297e69a159d8a0e3face3a Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 25 Nov 2020 11:19:49 +0300 Subject: [PATCH] test: fix localization.pipe.spec errors --- .../src/lib/tests/localization.pipe.spec.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts index a062d2c18a..f806beb802 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts @@ -2,27 +2,30 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect import { LocalizationPipe } from '../pipes'; import { Store } from '@ngxs/store'; import { ConfigState } from '../states'; +import { LocalizationService } from '../services'; describe('LocalizationPipe', () => { let spectator: SpectatorService; let pipe: LocalizationPipe; - let store: SpyObject; + let localizationService: SpyObject; - const createService = createServiceFactory({ service: LocalizationPipe, mocks: [Store] }); + const createService = createServiceFactory({ + service: LocalizationPipe, + mocks: [Store, LocalizationService], + }); beforeEach(() => { spectator = createService(); pipe = spectator.inject(LocalizationPipe); - store = spectator.inject(Store); + localizationService = spectator.inject(LocalizationService); }); it('should call getLocalization selector', () => { - const storeSpy = jest.spyOn(store, 'selectSnapshot'); - const configStateSpy = jest.spyOn(ConfigState, 'getLocalization'); + const translateSpy = jest.spyOn(localizationService, 'instant'); pipe.transform('test', '1', '2'); pipe.transform('test2', ['3', '4'] as any); - expect(configStateSpy).toHaveBeenCalledWith('test', '1', '2'); - expect(configStateSpy).toHaveBeenCalledWith('test2', '3', '4'); + expect(translateSpy).toHaveBeenCalledWith('test', '1', '2'); + expect(translateSpy).toHaveBeenCalledWith('test2', '3', '4'); }); });