Browse Source

test: fix testing errors

pull/4911/head
mehmet-erim 6 years ago
parent
commit
8d5abbb979
  1. 4
      npm/ng-packs/package.json
  2. 3
      npm/ng-packs/packages/core/src/lib/tests/initial-utils.spec.ts
  3. 6
      npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts

4
npm/ng-packs/package.json

@ -16,7 +16,7 @@
"scripts:build": "cd scripts && yarn && yarn build",
"prepare:workspace": "yarn scripts:build --noInstall",
"ci": "yarn ng lint && yarn prepare:workspace && yarn ci:test && yarn ci:build",
"ci:test": "ng test --coverage=false",
"ci:test": "ng test --coverage=false --silent",
"ci:build": "cd scripts && yarn build:prod",
"lerna": "lerna",
"compile:ivy": "yarn ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points --tsconfig './tsconfig.prod.json' --source node_modules --async false",
@ -99,4 +99,4 @@
"resolutions": {
"@ngx-validate/core": "^0.0.8"
}
}
}

3
npm/ng-packs/packages/core/src/lib/tests/initial-utils.spec.ts

@ -77,7 +77,8 @@ describe('InitialUtils', () => {
const injectorSpy = jest.spyOn(injector, 'get');
const store = spectator.inject(Store);
store.selectSnapshot.andCallFake(selector => selector({ SessionState: { language: 'tr' } }));
injectorSpy.mockReturnValue(store);
injectorSpy.mockReturnValueOnce(store);
injectorSpy.mockReturnValueOnce({ cultureNameToLocaleFileNameMapping: {} });
expect(typeof localeInitializer(injector)).toBe('function');
expect(await localeInitializer(injector)()).toBe('resolved');
});

6
npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts

@ -1,3 +1,4 @@
import { CORE_OPTIONS } from '../tokens/options.token';
import { Router } from '@angular/router';
import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
import { Actions, Store } from '@ngxs/store';
@ -13,7 +14,10 @@ describe('LocalizationService', () => {
service: LocalizationService,
entryComponents: [],
mocks: [Store, Router],
providers: [{ provide: Actions, useValue: new Subject() }],
providers: [
{ provide: Actions, useValue: new Subject() },
{ provide: CORE_OPTIONS, useValue: { cultureNameToLocaleFileNameMapping: {} } },
],
});
beforeEach(() => {

Loading…
Cancel
Save