Skip to content

Commit 5903b3e

Browse files
guguclaude
andcommitted
fix: register Chart.js components in chart-widget test
Add provideCharts(withDefaultRegisterables()) to test providers to fix "bar is not a registered controller" error. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c4a02de commit 5903b3e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

frontend/src/app/components/dashboards/widget-renderers/chart-widget/chart-widget.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { provideHttpClient } from '@angular/common/http';
22
import { provideHttpClientTesting } from '@angular/common/http/testing';
33
import { ComponentFixture, TestBed } from '@angular/core/testing';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
5+
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';
56
import { ChartWidgetComponent } from './chart-widget.component';
67

78
describe('ChartWidgetComponent', () => {
@@ -11,7 +12,7 @@ describe('ChartWidgetComponent', () => {
1112
beforeEach(async () => {
1213
await TestBed.configureTestingModule({
1314
imports: [ChartWidgetComponent, BrowserAnimationsModule],
14-
providers: [provideHttpClient(), provideHttpClientTesting()],
15+
providers: [provideHttpClient(), provideHttpClientTesting(), provideCharts(withDefaultRegisterables())],
1516
}).compileComponents();
1617

1718
fixture = TestBed.createComponent(ChartWidgetComponent);

0 commit comments

Comments
 (0)