20 lines
784 B
TypeScript
20 lines
784 B
TypeScript
import { RenderMode } from '@angular/ssr';
|
|
import { serverRoutes } from './app.routes.server';
|
|
|
|
describe('server routes', () => {
|
|
it('returns HTTP 404 from the catch-all and leaves prerendered routes without a status', () => {
|
|
const catchAll = serverRoutes.find((route) => route.path === '**');
|
|
|
|
expect(catchAll?.renderMode).toBe(RenderMode.Server);
|
|
expect(catchAll && 'status' in catchAll ? catchAll.status : undefined).toBe(404);
|
|
|
|
const prerendered = serverRoutes.filter((route) => route.path !== '**');
|
|
expect(prerendered.length).toBeGreaterThan(0);
|
|
|
|
for (const route of prerendered) {
|
|
expect(route.renderMode, route.path).toBe(RenderMode.Prerender);
|
|
expect('status' in route, `${route.path} must not set status`).toBe(false);
|
|
}
|
|
});
|
|
});
|