Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9701047

Browse filesBrowse files
committed
test(common): Add circular deps test to 19.2.x (#61651)
adds circular deps test for http client to 19.2.x branch PR Close #61651
1 parent 517cde4 commit 9701047
Copy full SHA for 9701047

1 file changed

+22Lines changed: 22 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/common/http/test/provider_spec.ts‎

Copy file name to clipboardExpand all lines: packages/common/http/test/provider_spec.ts
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
ApplicationRef,
2727
createEnvironmentInjector,
2828
EnvironmentInjector,
29+
ErrorHandler,
2930
inject,
3031
InjectionToken,
3132
PLATFORM_ID,
@@ -67,6 +68,27 @@ describe('without provideHttpClientTesting', () => {
6768
await Promise.resolve();
6869
expect(stable).toBe(true);
6970
});
71+
72+
it('can use an ErrorHandler that injects HttpClient', () => {
73+
// This test ensures there is no circular dependency:
74+
TestBed.configureTestingModule({
75+
providers: [
76+
provideHttpClient(
77+
withFetch(),
78+
withInterceptors([() => from(Promise.resolve(new HttpResponse()))]),
79+
),
80+
{
81+
provide: ErrorHandler,
82+
useClass: class extends ErrorHandler {
83+
client = inject(HttpClient);
84+
override handleError(error: any): void {}
85+
},
86+
},
87+
],
88+
});
89+
90+
expect(() => TestBed.inject(ApplicationRef)).not.toThrow();
91+
});
7092
});
7193

7294
describe('provideHttpClient', () => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.