From 847325c7c5d694b7e862cb6292dfbe7192a0e887 Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 6 Nov 2024 16:19:35 +0300 Subject: [PATCH] chore(demo): prevent DDoS github api from e2e tests --- projects/demo/src/modules/app/app.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/demo/src/modules/app/app.component.ts b/projects/demo/src/modules/app/app.component.ts index 7b05d5321ff9..7789e9a2ee5b 100644 --- a/projects/demo/src/modules/app/app.component.ts +++ b/projects/demo/src/modules/app/app.component.ts @@ -18,6 +18,7 @@ import {TuiDemo} from '@demo/utils'; import {WA_LOCAL_STORAGE} from '@ng-web-apis/common'; import {ResizeObserverService} from '@ng-web-apis/resize-observer'; import {TUI_DOC_SEARCH_ENABLED} from '@taiga-ui/addon-doc'; +import {TUI_IS_E2E} from '@taiga-ui/cdk'; import {TuiButton, TuiDataList, TuiDropdown, TuiIcon} from '@taiga-ui/core'; import {TuiBadgedContent} from '@taiga-ui/kit'; import {TuiSheetModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; @@ -69,6 +70,7 @@ import {TUI_VERSION_MANAGER_PROVIDERS} from './version-manager/version-manager.p ], }) export class App extends AbstractDemo implements OnInit { + private readonly isE2E = inject(TUI_IS_E2E); private readonly isServer = isPlatformServer(inject(PLATFORM_ID)); private readonly destroyRef = inject(DestroyRef); private readonly http = inject(HttpClient); @@ -91,12 +93,13 @@ export class App extends AbstractDemo implements OnInit { public override async ngOnInit(): Promise { await super.ngOnInit(); - this.enableYandexMetrika(); - if (this.isServer) { + if (this.isServer || this.isE2E) { return; } + this.enableYandexMetrika(); + this.http .get>(environment.github) .pipe(takeUntilDestroyed(this.destroyRef))