From 63a2df16f2022cb06ad0b80a081bd8108a3f9711 Mon Sep 17 00:00:00 2001 From: rshen91 Date: Mon, 12 Oct 2020 10:10:03 -0600 Subject: [PATCH] refactor: update integration tests --- .../rect/dimensions.integration.test.ts | 18 +++++++++++------- .../xy_chart/annotations/utils.test.ts | 2 -- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/chart_types/xy_chart/annotations/rect/dimensions.integration.test.ts b/src/chart_types/xy_chart/annotations/rect/dimensions.integration.test.ts index c8e022f376..1511b2c5b6 100644 --- a/src/chart_types/xy_chart/annotations/rect/dimensions.integration.test.ts +++ b/src/chart_types/xy_chart/annotations/rect/dimensions.integration.test.ts @@ -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 } }], @@ -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({ @@ -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', @@ -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, @@ -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 }, }); }); }); diff --git a/src/chart_types/xy_chart/annotations/utils.test.ts b/src/chart_types/xy_chart/annotations/utils.test.ts index 7bdea79c0b..aedaf5814c 100644 --- a/src/chart_types/xy_chart/annotations/utils.test.ts +++ b/src/chart_types/xy_chart/annotations/utils.test.ts @@ -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, }; @@ -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, };