CI Pipeline / backend-test (push) Successful in 9m4s
CI Pipeline / frontend-test (push) Successful in 24s
CI Pipeline / frontend-build (push) Successful in 32s
CI Pipeline / backend-lint (push) Successful in 14s
CI Pipeline / backend-test (pull_request) Successful in 9m17s
CI Pipeline / frontend-test (pull_request) Successful in 24s
CI Pipeline / frontend-build (pull_request) Successful in 30s
CI Pipeline / backend-lint (pull_request) Successful in 10s
CI Pipeline / quality-gate (push) Successful in 2s
CI Pipeline / quality-gate (pull_request) Successful in 2s
- ThemeService: remove isPlatformBrowser guard so CSS custom properties are applied during SSR/prerender — server-rendered HTML now carries the correct color scheme and gradients (fixes missing colors on test site). - main.ts: add provideClientHydration() so Angular preserves the server- rendered DOM on the client instead of destroying and rebuilding it (fixes jarring full-page reload between static and dynamic versions). - Tests: update theme.service.spec.ts to match new behaviour, expand coverage with gradient tests and empty-value handling (9 tests). Fix structured-data.component.spec.ts import paths. All 54 tests pass.
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// Load the JIT compiler BEFORE any Angular router/common imports
|
|
import '@angular/compiler';
|
|
|
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
import { Injector, PLATFORM_ID } from '@angular/core';
|
|
import { StructuredDataComponent } from './structured-data.component';
|
|
import { StructuredDataService } from '../services/structured-data.service';
|
|
|
|
describe('StructuredDataComponent — SSR compatibility', () => {
|
|
let serviceMock: any;
|
|
|
|
beforeEach(() => {
|
|
serviceMock = {
|
|
structuredData: vi.fn(() => []),
|
|
};
|
|
});
|
|
|
|
it('should NOT throw when instantiated on the server platform', () => {
|
|
expect(() => {
|
|
Injector.create({
|
|
providers: [
|
|
{ provide: PLATFORM_ID, useValue: 'server' },
|
|
{ provide: StructuredDataService, useValue: serviceMock },
|
|
{
|
|
provide: StructuredDataComponent,
|
|
useFactory: () => new StructuredDataComponent(),
|
|
deps: [],
|
|
},
|
|
],
|
|
});
|
|
}).not.toThrow();
|
|
});
|
|
|
|
it('should instantiate without errors on the browser platform', () => {
|
|
expect(() => {
|
|
Injector.create({
|
|
providers: [
|
|
{ provide: PLATFORM_ID, useValue: 'browser' },
|
|
{ provide: StructuredDataService, useValue: serviceMock },
|
|
{
|
|
provide: StructuredDataComponent,
|
|
useFactory: () => new StructuredDataComponent(),
|
|
deps: [],
|
|
},
|
|
],
|
|
});
|
|
}).not.toThrow();
|
|
});
|
|
});
|