-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6810 from abpframework/testing/6802
Add ThemeSharedTestingModule and improved CoreTestingModule
- Loading branch information
Showing
14 changed files
with
149 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './mock-rest.service'; |
21 changes: 21 additions & 0 deletions
21
npm/ng-packs/packages/core/testing/src/lib/services/mock-rest.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ABP, CORE_OPTIONS, EnvironmentService, RestService } from '@abp/ng.core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Inject, Injectable } from '@angular/core'; | ||
import { Observable, throwError } from 'rxjs'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class MockRestService extends RestService { | ||
constructor( | ||
@Inject(CORE_OPTIONS) protected options: ABP.Root, | ||
protected http: HttpClient, | ||
protected environment: EnvironmentService, | ||
) { | ||
super(options, http, environment, null); | ||
} | ||
|
||
handleError(err: any): Observable<any> { | ||
return throwError(err); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/theme-shared/testing", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
npm/ng-packs/packages/theme-shared/testing/src/lib/theme-shared-testing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { | ||
BaseThemeSharedModule, | ||
DateParserFormatter, | ||
THEME_SHARED_ROUTE_PROVIDERS, | ||
} from '@abp/ng.theme.shared'; | ||
import { ModuleWithProviders, NgModule } from '@angular/core'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
/** | ||
* ThemeSharedTestingModule is the module that will be used in tests | ||
*/ | ||
@NgModule({ | ||
exports: [RouterTestingModule, BaseThemeSharedModule], | ||
imports: [RouterTestingModule, BaseThemeSharedModule], | ||
}) | ||
export class ThemeSharedTestingModule { | ||
static withConfig(): ModuleWithProviders<ThemeSharedTestingModule> { | ||
return { | ||
ngModule: ThemeSharedTestingModule, | ||
providers: [ | ||
THEME_SHARED_ROUTE_PROVIDERS, | ||
{ provide: NgbDateParserFormatter, useClass: DateParserFormatter }, | ||
], | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/theme-shared-testing.module'; |
Oops, something went wrong.