Skip to content

Commit

Permalink
Rename to add errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JCQuintas committed May 29, 2024
1 parent e4e83ea commit 5b3d3f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/x-charts/src/BarChart/BarPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AnimationData, CompletedBarData, MaskData } from './types';
import { BarClipPath } from './BarClipPath';
import { BarLabelItemProps, BarLabelSlotProps, BarLabelSlots } from './BarLabel/BarLabelItem';
import { BarLabelPlot } from './BarLabel/BarLabelPlot';
import { checkScale } from './checkScale';
import { checkScaleErrors } from './checkScaleErrors';

/**
* Solution of the equations
Expand Down Expand Up @@ -109,7 +109,7 @@ const useAggregatedData = (): {

const verticalLayout = series[seriesId].layout === 'vertical';

checkScale(verticalLayout, seriesId, xAxisKey, xAxis, yAxisKey, yAxis);
checkScaleErrors(verticalLayout, seriesId, xAxisKey, xAxis, yAxisKey, yAxis);

const baseScaleConfig = (
verticalLayout ? xAxisConfig : yAxisConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { expect } from 'chai';
import { checkScale } from './checkScale';
import { checkScaleErrors } from './checkScaleErrors';
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';

describe('BarChart - checkScale', () => {
describe('BarChart - checkScaleErrors', () => {
describe('verticalLayout: true', () => {
it('should throw an error when the x-axis is not a band scale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
true,
'seriesId',
xKey,
Expand All @@ -30,7 +30,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
true,
'seriesId',
xKey,
Expand All @@ -50,7 +50,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
true,
'seriesId',
xKey,
Expand All @@ -72,7 +72,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
true,
'seriesId',
xKey,
Expand All @@ -94,7 +94,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
false,
'seriesId',
xKey,
Expand All @@ -116,7 +116,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
false,
'seriesId',
xKey,
Expand All @@ -136,7 +136,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
false,
'seriesId',
xKey,
Expand All @@ -158,7 +158,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = DEFAULT_X_AXIS_KEY;
const yKey = DEFAULT_Y_AXIS_KEY;
checkScale(
checkScaleErrors(
false,
'seriesId',
xKey,
Expand All @@ -179,7 +179,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = 'x-test';
const yKey = 'y-test';
checkScale(
checkScaleErrors(
true,
'seriesId',
xKey,
Expand All @@ -201,7 +201,7 @@ describe('BarChart - checkScale', () => {
expect(() => {
const xKey = 'x-test';
const yKey = 'y-test';
checkScale(
checkScaleErrors(
false,
'seriesId',
xKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const getAxisMessage = (isVertical: boolean, axisKey: string, isContinuous: bool
: `The ${axisName} with id "${axisKey}"`;
};

export function checkScale(
export function checkScaleErrors(
verticalLayout: boolean,
seriesId: SeriesId,
xAxisKey: string,
Expand Down

0 comments on commit 5b3d3f3

Please sign in to comment.