Skip to content

Commit

Permalink
Add unit test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush2303 committed Jan 27, 2025
1 parent 1a04b90 commit 000ed54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,24 @@ describe('prepareDatapoints', () => {
});

it('should return an array with rounded data points when roundedTicks is true and yMinValue is negative', () => {
const result = utils.prepareDatapoints(100, -100, 4, true, true);
const result = utils.prepareDatapoints(100, -100, 4, false, true);
matchResult(result);
});

it('should return an array with rounded data points when roundedTicks is true and yMaxValue is negative', () => {
const result = utils.prepareDatapoints(-100, -200, 4, true, true);
matchResult(result);
});

it('should return an array with rounded data points with non-integral dataset', () => {
const result = utils.prepareDatapoints(12.8, -8.4, 4, true, true);
matchResult(result);
});

it('should return an array with rounded data points with large numbers in dataset', () => {
const result = utils.prepareDatapoints(1000000, -1000000, 4, true, true);
matchResult(result);
});
});

const createYAxisParams = (yAxisParams?: Partial<utils.IYAxisParams>): utils.IYAxisParams => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3842,6 +3842,27 @@ Array [
]
`;

exports[`prepareDatapoints should return an array with rounded data points with large numbers in dataset 1`] = `
Array [
-1000000,
-500000,
0,
500000,
1000000,
]
`;

exports[`prepareDatapoints should return an array with rounded data points with non-integral dataset 1`] = `
Array [
-10,
-5,
0,
5,
10,
15,
]
`;

exports[`prepareDatapoints should return data points for a negative only range 1`] = `
Array [
-5,
Expand Down

0 comments on commit 000ed54

Please sign in to comment.