style(frontend): applique prettier aux fichiers du tableau de bord
Les onze fichiers non conformes au .prettierrc du projet etaient exactement ceux introduits ou modifies par cette branche ; les vingt-deux autres du frontend etaient deja propres. Aucune modification de comportement : indentation, virgules finales et longueur de ligne a 100 caracteres.
This commit is contained in:
@@ -28,25 +28,46 @@ describe('SiteLoadChart', () => {
|
||||
TestBed.configureTestingModule({ imports: [SiteLoadChart] });
|
||||
const fixture = TestBed.createComponent(SiteLoadChart);
|
||||
fixture.componentRef.setInput('sites', [
|
||||
{ site_id: 'S1', site_name: 'Test', current_consumption_kw: 50, capacity_kw: 100, load_percent: 50, data_quality: 'good' },
|
||||
{
|
||||
site_id: 'S1',
|
||||
site_name: 'Test',
|
||||
current_consumption_kw: 50,
|
||||
capacity_kw: 100,
|
||||
load_percent: 50,
|
||||
data_quality: 'good',
|
||||
},
|
||||
]);
|
||||
expect(() => fixture.detectChanges()).not.toThrow();
|
||||
});
|
||||
it('met à jour le graphique quand les sites changent après initialisation', () => {
|
||||
TestBed.configureTestingModule({ imports: [SiteLoadChart] });
|
||||
const fixture = TestBed.createComponent(SiteLoadChart);
|
||||
fixture.componentRef.setInput('sites', [
|
||||
{ site_id: 'S1', site_name: 'A', current_consumption_kw: 50, capacity_kw: 100, load_percent: 50, data_quality: 'good' },
|
||||
]);
|
||||
fixture.detectChanges(); // déclenche ngAfterViewInit, this.chart existe désormais
|
||||
TestBed.configureTestingModule({ imports: [SiteLoadChart] });
|
||||
const fixture = TestBed.createComponent(SiteLoadChart);
|
||||
fixture.componentRef.setInput('sites', [
|
||||
{
|
||||
site_id: 'S1',
|
||||
site_name: 'A',
|
||||
current_consumption_kw: 50,
|
||||
capacity_kw: 100,
|
||||
load_percent: 50,
|
||||
data_quality: 'good',
|
||||
},
|
||||
]);
|
||||
fixture.detectChanges(); // déclenche ngAfterViewInit, this.chart existe désormais
|
||||
|
||||
fixture.componentRef.setInput('sites', [
|
||||
{ site_id: 'S2', site_name: 'B', current_consumption_kw: 80, capacity_kw: 100, load_percent: 80, data_quality: 'critical' },
|
||||
]);
|
||||
fixture.detectChanges(); // ré-exécute l'effect, cette fois avec this.chart défini
|
||||
fixture.componentRef.setInput('sites', [
|
||||
{
|
||||
site_id: 'S2',
|
||||
site_name: 'B',
|
||||
current_consumption_kw: 80,
|
||||
capacity_kw: 100,
|
||||
load_percent: 80,
|
||||
data_quality: 'critical',
|
||||
},
|
||||
]);
|
||||
fixture.detectChanges(); // ré-exécute l'effect, cette fois avec this.chart défini
|
||||
|
||||
expect(() => fixture.detectChanges()).not.toThrow();
|
||||
});
|
||||
expect(() => fixture.detectChanges()).not.toThrow();
|
||||
});
|
||||
|
||||
it('détruit le graphique quand le composant est détruit', () => {
|
||||
TestBed.configureTestingModule({ imports: [SiteLoadChart] });
|
||||
|
||||
Reference in New Issue
Block a user