mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 19:13:46 +00:00
Silenced ts errors on chart tests
This commit is contained in:
@@ -19,9 +19,9 @@ describe('<DoughnutChart />', () => {
|
|||||||
|
|
||||||
expect(doughnut).toHaveLength(1);
|
expect(doughnut).toHaveLength(1);
|
||||||
|
|
||||||
const { labels, datasets } = doughnut.prop('data');
|
const { labels, datasets } = doughnut.prop('data') as any;
|
||||||
const [{ data, backgroundColor, borderColor }] = datasets;
|
const [{ data, backgroundColor, borderColor }] = datasets;
|
||||||
const { plugins, scales } = doughnut.prop('options') ?? {};
|
const { plugins, scales } = (doughnut.prop('options') ?? {}) as any;
|
||||||
|
|
||||||
expect(labels).toEqual(keys(stats));
|
expect(labels).toEqual(keys(stats));
|
||||||
expect(data).toEqual(values(stats));
|
expect(data).toEqual(values(stats));
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ describe('<HorizontalBarChart />', () => {
|
|||||||
|
|
||||||
expect(horizontal).toHaveLength(1);
|
expect(horizontal).toHaveLength(1);
|
||||||
|
|
||||||
const { datasets: [{ backgroundColor, borderColor }] } = horizontal.prop('data');
|
const { datasets: [{ backgroundColor, borderColor }] } = horizontal.prop('data') as any;
|
||||||
const { plugins, scales } = horizontal.prop('options') ?? {};
|
const { plugins, scales } = (horizontal.prop('options') ?? {}) as any;
|
||||||
|
|
||||||
expect(backgroundColor).toEqual(MAIN_COLOR_ALPHA);
|
expect(backgroundColor).toEqual(MAIN_COLOR_ALPHA);
|
||||||
expect(borderColor).toEqual(MAIN_COLOR);
|
expect(borderColor).toEqual(MAIN_COLOR);
|
||||||
@@ -48,7 +48,7 @@ describe('<HorizontalBarChart />', () => {
|
|||||||
wrapper = shallow(<HorizontalBarChart stats={stats} highlightedStats={highlightedStats} />);
|
wrapper = shallow(<HorizontalBarChart stats={stats} highlightedStats={highlightedStats} />);
|
||||||
const horizontal = wrapper.find(Bar);
|
const horizontal = wrapper.find(Bar);
|
||||||
|
|
||||||
const { datasets: [{ data, label }, highlightedData ] } = horizontal.prop('data');
|
const { datasets: [{ data, label }, highlightedData ] } = horizontal.prop('data') as any;
|
||||||
|
|
||||||
expect(label).toEqual('Visits');
|
expect(label).toEqual('Visits');
|
||||||
expect(data).toEqual(expectedData);
|
expect(data).toEqual(expectedData);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ describe('<LineChartCard />', () => {
|
|||||||
])('renders chart with expected data', (visits, highlightedVisits, expectedLines) => {
|
])('renders chart with expected data', (visits, highlightedVisits, expectedLines) => {
|
||||||
const wrapper = createWrapper(visits, highlightedVisits);
|
const wrapper = createWrapper(visits, highlightedVisits);
|
||||||
const chart = wrapper.find(Line);
|
const chart = wrapper.find(Line);
|
||||||
const { datasets } = chart.prop('data');
|
const { datasets } = chart.prop('data') as any;
|
||||||
|
|
||||||
expect(datasets).toHaveLength(expectedLines);
|
expect(datasets).toHaveLength(expectedLines);
|
||||||
});
|
});
|
||||||
@@ -96,8 +96,8 @@ describe('<LineChartCard />', () => {
|
|||||||
Mock.of<NormalizedVisit>({ date: '2016-01-01' }),
|
Mock.of<NormalizedVisit>({ date: '2016-01-01' }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(wrapper.find(Line).prop('data').labels).toHaveLength(2);
|
expect((wrapper.find(Line).prop('data') as any).labels).toHaveLength(2);
|
||||||
wrapper.find(ToggleSwitch).simulate('change');
|
wrapper.find(ToggleSwitch).simulate('change');
|
||||||
expect(wrapper.find(Line).prop('data').labels).toHaveLength(4);
|
expect((wrapper.find(Line).prop('data') as any).labels).toHaveLength(4);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user