Skip to content

Commit

Permalink
chore(demo): prevent DDoS github api from e2e tests (#9706)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Nov 6, 2024
1 parent 67a468c commit c5c5115
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions projects/demo/src/modules/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -91,12 +93,13 @@ export class App extends AbstractDemo implements OnInit {

public override async ngOnInit(): Promise<void> {
await super.ngOnInit();
this.enableYandexMetrika();

if (this.isServer) {
if (this.isServer || this.isE2E) {
return;
}

this.enableYandexMetrika();

this.http
.get<Record<string, any>>(environment.github)
.pipe(takeUntilDestroyed(this.destroyRef))
Expand Down

0 comments on commit c5c5115

Please sign in to comment.