Skip to content

Commit

Permalink
fix: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 committed Dec 20, 2023
1 parent d6e4eee commit 6648548
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/plugins/d3/renderer/validation/__tests__/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe('plugins/d3/validation', () => {
});

test.each<ChartKitWidgetData>([
PIE_SERIES.INVALID_VALUE,
XY_SERIES.INVALID_CATEGORY_X,
XY_SERIES.INVALID_CATEGORY_Y,
XY_SERIES.INVALID_DATETIME_X,
Expand All @@ -52,7 +51,22 @@ describe('plugins/d3/validation', () => {
} catch (e) {
error = e as ChartKitError;
}
// console.log(error?.message);

expect(error?.code).toEqual(CHARTKIT_ERROR_CODE.INVALID_DATA);
},
);

test.each<ChartKitWidgetData>([PIE_SERIES.INVALID_VALUE])(
'[Pie Series] validateData should throw an error in case of invalid data (data: %j)',
(data) => {
let error: ChartKitError | null = null;

try {
validateData(data);
} catch (e) {
error = e as ChartKitError;
}

expect(error?.code).toEqual(CHARTKIT_ERROR_CODE.INVALID_DATA);
},
);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/d3/renderer/validation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {DEFAULT_AXIS_TYPE} from '../constants';
type XYSeries = ScatterSeries | BarXSeries | BarYSeries | LineSeries;

const AVAILABLE_SERIES_TYPES: ChartKitWidgetSeries['type'][] = [
'area',
'bar-x',
'bar-y',
'line',
Expand Down

0 comments on commit 6648548

Please sign in to comment.