Browse Source

test: use CoreModule.forRoot in config plugin tests

pull/3698/head
Arman Ozak 7 years ago
parent
commit
9e6e940db8
  1. 25
      npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts

25
npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts

@ -1,16 +1,15 @@
import { RouterTestingModule } from '@angular/router/testing';
import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest';
import { NgxsModule, NGXS_PLUGINS, Store } from '@ngxs/store';
import { NgxsModule, Store } from '@ngxs/store';
import { OAuthModule } from 'angular-oauth2-oidc';
import { environment } from '../../../../../apps/dev-app/src/environments/environment';
import { LAYOUTS } from '@abp/ng.theme.basic';
import { RouterOutletComponent } from '../components';
import { CoreModule } from '../core.module';
import { eLayoutType } from '../enums/common';
import { ABP } from '../models';
import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from '../plugins';
import { ConfigPlugin } from '../plugins';
import { ConfigState } from '../states';
import { addAbpRoutes } from '../utils';
import { OAuthModule } from 'angular-oauth2-oidc';
addAbpRoutes([
{
@ -60,9 +59,6 @@ addAbpRoutes([
const expectedState = {
environment,
requirements: {
layouts: LAYOUTS,
},
routes: [
{
name: '::Menu:Home',
@ -323,9 +319,9 @@ describe('ConfigPlugin', () => {
const createService = createServiceFactory({
service: ConfigPlugin,
imports: [
CoreModule,
NgxsModule.forRoot([ConfigState]),
CoreModule.forRoot({ environment }),
OAuthModule.forRoot(),
NgxsModule.forRoot([]),
RouterTestingModule.withRoutes([
{
path: '',
@ -341,17 +337,6 @@ describe('ConfigPlugin', () => {
{ path: 'tenant-management', component: RouterOutletComponent },
]),
],
providers: [
{
provide: NGXS_PLUGINS,
useClass: ConfigPlugin,
multi: true,
},
{
provide: NGXS_CONFIG_PLUGIN_OPTIONS,
useValue: { environment, requirements: { layouts: LAYOUTS } } as ABP.Root,
},
],
});
beforeEach(() => {

Loading…
Cancel
Save