- Add SensorReading model with CO2, temperature, humidity, window state, timestamp - Add RoomService and SensorService with HTTP calls and mock data fallback - Rewrite RoomMapComponent: SVG floor plan, CO2-based coloring, tooltips, navigation - Rewrite RoomDetailsPanelComponent: sensor history table with pagination (8 rows/page) - Add FooterComponent with current year, fix header/footer sticky layout - Update LegendComponent template and styles for two-line item layout - Add provideHttpClient() to app.config.ts - Add getCO2Color() and getCO2Level() helpers to co2-levels.config.ts - Add 85 unit tests across all components, services, and config helpers Closes #28 Closes #29
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
import { provideRouter } from '@angular/router';
|
|
import { HeaderComponent } from './header.component';
|
|
|
|
describe('HeaderComponent', () => {
|
|
let fixture: ComponentFixture<HeaderComponent>;
|
|
let compiled: HTMLElement;
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
imports: [HeaderComponent],
|
|
providers: [provideRouter([])],
|
|
}).compileComponents();
|
|
|
|
fixture = TestBed.createComponent(HeaderComponent);
|
|
fixture.detectChanges();
|
|
compiled = fixture.nativeElement as HTMLElement;
|
|
});
|
|
|
|
it('should create', () => {
|
|
expect(fixture.componentInstance).toBeTruthy();
|
|
});
|
|
|
|
it('should render a <header> element', () => {
|
|
expect(compiled.querySelector('header')).toBeTruthy();
|
|
});
|
|
|
|
it('should contain a navigation link to /dashboard', () => {
|
|
const link = compiled.querySelector(
|
|
'a[routerLink="/dashboard"], a[ng-reflect-router-link="/dashboard"], h1 a'
|
|
);
|
|
expect(link).toBeTruthy();
|
|
});
|
|
|
|
it('should display the project name', () => {
|
|
const text = compiled.textContent ?? '';
|
|
expect(text).toContain('PI_E2EEDA');
|
|
});
|
|
|
|
it('should render a <nav> element', () => {
|
|
expect(compiled.querySelector('nav')).toBeTruthy();
|
|
});
|
|
});
|