Skip to content

Commit

Permalink
refactor: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rshen91 committed Oct 12, 2020
1 parent 19bc042 commit 63a2df1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ describe('Render rect annotation within', () => {
});

it('annotation with no height will take the chart dimension height', () => {
const store = MockStore.default({ top: 0, left: 0, width: 20, height: 200 });
const height = 200;
const store = MockStore.default({ top: 0, left: 0, width: 20, height });
const settings = MockGlobalSpec.settingsNoMargins();
const annotation = MockAnnotationSpec.rect({
dataValues: [{ coordinates: { x0: 2, x1: 4 } }],
Expand All @@ -274,11 +275,12 @@ describe('Render rect annotation within', () => {
const expected = computeAnnotationDimensionsSelector(store.getState());
const [resultAnnotation] = expected.get('rect_annotation_1') ?? [];
expect(resultAnnotation).toMatchObject({
rect: { height: 200 },
rect: { height },
});
});
it('annotation with fit domain will render', () => {
const store = MockStore.default({ top: 0, left: 0, width: 20, height: 200 });
const heightFromStore = 200;
const store = MockStore.default({ top: 0, left: 0, width: 20, height: heightFromStore });
const settings = MockGlobalSpec.settingsNoMargins();
const yDomainFitted = MockGlobalSpec.axis({ domain: { fit: true } });
const annotation = MockAnnotationSpec.rect({
Expand All @@ -299,7 +301,8 @@ describe('Render rect annotation within', () => {
});
});
it('annotation with group id should render with x0 and x1 values', () => {
const store = MockStore.default({ top: 0, left: 0, width: 20, height: 200 });
const height = 200;
const store = MockStore.default({ top: 0, left: 0, width: 20, height });
const settings = MockGlobalSpec.settingsNoMargins();
const annotation = MockAnnotationSpec.rect({
groupId: 'group1',
Expand All @@ -316,11 +319,12 @@ describe('Render rect annotation within', () => {
const expected = computeAnnotationDimensionsSelector(store.getState());
const [resultAnnotation] = expected.get('rect_annotation_1') ?? [];
expect(resultAnnotation).toMatchObject({
rect: { height: 200 },
rect: { height },
});
});
it('annotation with no group id should render', () => {
const store = MockStore.default({ top: 0, left: 0, width: 20, height: 200 });
const height = 200;
const store = MockStore.default({ top: 0, left: 0, width: 20, height });
const settings = MockGlobalSpec.settingsNoMargins();
const annotation = MockAnnotationSpec.rect({
groupId: undefined,
Expand All @@ -337,7 +341,7 @@ describe('Render rect annotation within', () => {
const expected = computeAnnotationDimensionsSelector(store.getState());
const [resultAnnotation] = expected.get('rect_annotation_1') ?? [];
expect(resultAnnotation).toMatchObject({
rect: { height: 200 },
rect: { height },
});
});
});
2 changes: 0 additions & 2 deletions src/chart_types/xy_chart/annotations/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('annotation utils', () => {
showOverlappingLabels: false,
position: Position.Left,
style,
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
tickFormat: (value: any) => value.toString(),
showGridLines: true,
};
Expand All @@ -106,7 +105,6 @@ describe('annotation utils', () => {
showOverlappingLabels: false,
position: Position.Bottom,
style,
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
tickFormat: (value: any) => value.toString(),
showGridLines: true,
};
Expand Down

0 comments on commit 63a2df1

Please sign in to comment.