Skip to content

Commit

Permalink
some more boiler plate
Browse files Browse the repository at this point in the history
  • Loading branch information
cskiwi committed Jun 6, 2024
1 parent 0a66ced commit 6714e4e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
15 changes: 11 additions & 4 deletions libs/frontend/root/src/config/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ import {
PLATFORM_ID,
provideZoneChangeDetection,
} from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, withViewTransitions } from '@angular/router';
import { appRoutes } from './app.routes';
import { provideClientHydration } from '@angular/platform-browser';
import {
provideClientHydration,
withHttpTransferCacheOptions,
} from '@angular/platform-browser';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { provideHttpClient, withFetch } from '@angular/common/http';
import { BASE_URL } from '@app/frontend-utils';
import { isPlatformBrowser } from '@angular/common';

export const appConfig: ApplicationConfig = {
providers: [
provideClientHydration(),
provideClientHydration(
withHttpTransferCacheOptions({
includePostRequests: true,
}),
),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(appRoutes),
provideRouter(appRoutes, withViewTransitions()),
provideAnimationsAsync(),
provideHttpClient(withFetch()),
{
Expand Down
2 changes: 1 addition & 1 deletion libs/frontend/root/src/root/root.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<button mat-icon-button (click)="snav.toggle()" aria-label="Open/Close sidenav">
<mat-icon>menu</mat-icon>
</button>
<h1 class="app-name">Responsive App</h1>
<h1 class="app-name">Material + Nestjs!</h1>
</mat-toolbar>

<mat-sidenav-container class="sidenav-container">
Expand Down
8 changes: 6 additions & 2 deletions libs/frontend/root/src/root/root.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { provideHttpClient } from '@angular/common/http';
import { TestBed } from '@angular/core/testing';
import { RootComponent } from './root.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';

describe('RootComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
providers: [provideHttpClient()],
imports: [RootComponent],
imports: [RootComponent, NoopAnimationsModule, RouterModule.forRoot([])],
}).compileComponents();
});

it('should render title', () => {
const fixture = TestBed.createComponent(RootComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Welcome app');
expect(compiled.querySelector('h1')?.textContent).toContain(
'Material + Nestjs!',
);
});
});

0 comments on commit 6714e4e

Please sign in to comment.