Browse Source

adding OTHERS_GROUP and SORT_COMPARE_FUNC injection tokens to CoreTestingModule to prevent injection errors

pull/19571/head
Yusuf Çırak 2 years ago
parent
commit
e90ac0acd5
  1. 14
      npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts

14
npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts

@ -8,6 +8,9 @@ import {
PermissionService, PermissionService,
RestService, RestService,
INCUDE_LOCALIZATION_RESOURCES_TOKEN, INCUDE_LOCALIZATION_RESOURCES_TOKEN,
OTHERS_GROUP,
compareFuncFactory,
SORT_COMPARE_FUNC,
} from '@abp/ng.core'; } from '@abp/ng.core';
import { APP_BASE_HREF } from '@angular/common'; import { APP_BASE_HREF } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core'; import { ModuleWithProviders, NgModule } from '@angular/core';
@ -16,6 +19,7 @@ import { provideRoutes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { MockPermissionService } from './services/mock-permission.service'; import { MockPermissionService } from './services/mock-permission.service';
import { MockRestService } from './services/mock-rest.service'; import { MockRestService } from './services/mock-rest.service';
import { LocalizationPipe } from './pipes';
/** /**
* CoreTestingModule is the module that will be used in tests * CoreTestingModule is the module that will be used in tests
@ -23,7 +27,7 @@ import { MockRestService } from './services/mock-rest.service';
*/ */
@NgModule({ @NgModule({
exports: [RouterTestingModule, BaseCoreModule], exports: [RouterTestingModule, BaseCoreModule],
imports: [NoopAnimationsModule, RouterTestingModule, BaseCoreModule], imports: [NoopAnimationsModule, RouterTestingModule, BaseCoreModule, LocalizationPipe],
}) })
export class CoreTestingModule { export class CoreTestingModule {
static withConfig( static withConfig(
@ -65,6 +69,14 @@ export class CoreTestingModule {
provide: INCUDE_LOCALIZATION_RESOURCES_TOKEN, provide: INCUDE_LOCALIZATION_RESOURCES_TOKEN,
useValue: false, useValue: false,
}, },
{
provide: OTHERS_GROUP,
useValue: 'AbpUi::OthersGroup',
},
{
provide: SORT_COMPARE_FUNC,
useFactory: compareFuncFactory,
},
provideRoutes(routes), provideRoutes(routes),
], ],
}; };

Loading…
Cancel
Save