Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Feb 6, 2020
1 parent aa2dca1 commit 3ee3dd8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';

import { BarChartBaseComponent, BarChartComponent } from './barchart';
import { ChartSeriesData } from './common';
import { ScaleType } from '@elastic/charts';
import { Chart, BarSeries, Axis, ScaleType } from '@elastic/charts';

jest.mock('../../lib/kibana');

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('BarChartBaseComponent', () => {
});

it('should render two bar series', () => {
expect(shallowWrapper.find('MemoChart')).toHaveLength(1);
expect(shallowWrapper.find(Chart)).toHaveLength(1);
});
});

Expand Down Expand Up @@ -167,14 +167,13 @@ describe('BarChartBaseComponent', () => {
});

it(`should ${mockBarChartData.length} render BarSeries`, () => {
expect(shallow).toMatchSnapshot();
expect(shallowWrapper.find('MemoBarSeries')).toHaveLength(mockBarChartData.length);
expect(shallowWrapper.find(BarSeries)).toHaveLength(mockBarChartData.length);
});

it('should render BarSeries with given xScaleType', () => {
expect(
shallowWrapper
.find('MemoBarSeries')
.find(BarSeries)
.first()
.prop('xScaleType')
).toEqual(configs.series.xScaleType);
Expand All @@ -183,7 +182,7 @@ describe('BarChartBaseComponent', () => {
it('should render BarSeries with given yScaleType', () => {
expect(
shallowWrapper
.find('MemoBarSeries')
.find(BarSeries)
.first()
.prop('yScaleType')
).toEqual(configs.series.yScaleType);
Expand All @@ -192,7 +191,7 @@ describe('BarChartBaseComponent', () => {
it('should render xAxis with given tick formatter', () => {
expect(
shallowWrapper
.find('MemoAxis')
.find(Axis)
.first()
.prop('tickFormat')
).toBeUndefined();
Expand All @@ -201,7 +200,7 @@ describe('BarChartBaseComponent', () => {
it('should render yAxis with given tick formatter', () => {
expect(
shallowWrapper
.find('MemoAxis')
.find(Axis)
.last()
.prop('tickFormat')
).toEqual(mockNumberFormatter);
Expand All @@ -217,13 +216,13 @@ describe('BarChartBaseComponent', () => {

it(`should ${mockBarChartData.length} render BarSeries`, () => {
expect(shallow).toMatchSnapshot();
expect(shallowWrapper.find('MemoBarSeries')).toHaveLength(mockBarChartData.length);
expect(shallowWrapper.find(BarSeries)).toHaveLength(mockBarChartData.length);
});

it('should render BarSeries with default xScaleType: Linear', () => {
expect(
shallowWrapper
.find('MemoBarSeries')
.find(BarSeries)
.first()
.prop('xScaleType')
).toEqual(ScaleType.Linear);
Expand All @@ -232,7 +231,7 @@ describe('BarChartBaseComponent', () => {
it('should render BarSeries with default yScaleType: Linear', () => {
expect(
shallowWrapper
.find('MemoBarSeries')
.find(BarSeries)
.first()
.prop('yScaleType')
).toEqual(ScaleType.Linear);
Expand All @@ -241,7 +240,7 @@ describe('BarChartBaseComponent', () => {
it('should not format xTicks value', () => {
expect(
shallowWrapper
.find('MemoAxis')
.find(Axis)
.last()
.prop('tickFormat')
).toBeUndefined();
Expand All @@ -250,7 +249,7 @@ describe('BarChartBaseComponent', () => {
it('should not format yTicks value', () => {
expect(
shallowWrapper
.find('MemoAxis')
.find(Axis)
.last()
.prop('tickFormat')
).toBeUndefined();
Expand All @@ -265,7 +264,7 @@ describe('BarChartBaseComponent', () => {
});

it('should not render without height and width', () => {
expect(shallowWrapper.find('Chart')).toHaveLength(0);
expect(shallowWrapper.find(Chart)).toHaveLength(0);
});
});
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ee3dd8

Please sign in to comment.