Skip to content

Commit

Permalink
refactor: fix lint errors after deps upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 committed Jan 5, 2021
1 parent 46f7336 commit 68065a7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 57 deletions.
6 changes: 3 additions & 3 deletions src/chart_types/partition_chart/layout/utils/calcs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ describe('calcs', () => {
const result = makeHighContrastColor('#fff', '#fff');
expect(result).toBe(expected);
});
it('rgb input - should change white text to black when background is white ', () => {
it('rgb input - should change white text to black when background is white', () => {
const expected = '#000';
const result = makeHighContrastColor('rgb(255, 255, 255)', 'rgb(255, 255, 255)');
expect(result).toBe(expected);
});
it('rgba input - should change white text to black when background is white ', () => {
it('rgba input - should change white text to black when background is white', () => {
const expected = '#000';
const result = makeHighContrastColor('rgba(255, 255, 255, 1)', 'rgba(255, 255, 255, 1)');
expect(result).toBe(expected);
});
it('word input - should change white text to black when background is white ', () => {
it('word input - should change white text to black when background is white', () => {
const expected = '#000';
const result = makeHighContrastColor('white', 'white');
expect(result).toBe(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Render vertical line annotation within', () => {
expectAnnotationAtPosition(data, 'line', dataValue, linePosition, numOfSpecs, ScaleType.Ordinal);
});

it('histogramMode with line after the max value but before the max + minInterval ', () => {
it('histogramMode with line after the max value but before the max + minInterval', () => {
const store = MockStore.default();
const settings = MockGlobalSpec.settingsNoMargins({
xDomain: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/

// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable jest/no-conditional-expect */
import { Store } from 'redux';

import { ChartTypes } from '../..';
Expand Down
92 changes: 45 additions & 47 deletions src/chart_types/xy_chart/state/utils/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,56 +131,54 @@ describe('Type Checks', () => {
});
});

describe('', () => {
test('displays no data availble if chart is empty', () => {
const legendItems1: LegendItem[] = [
{
color: '#1EA593',
label: 'a',
seriesIdentifier: {
key: 'specId:{bars},colors:{a}',
specId: 'bars',
},
defaultExtra: { raw: 6, formatted: '6.00', legendSizingLabel: '6.00' },
isSeriesHidden: true,
test('displays no data available if chart is empty', () => {
const legendItems1: LegendItem[] = [
{
color: '#1EA593',
label: 'a',
seriesIdentifier: {
key: 'specId:{bars},colors:{a}',
specId: 'bars',
},
{
color: '#2B70F7',
label: 'b',
seriesIdentifier: {
key: 'specId:{bars},colors:{b}',
specId: 'bars',
},
defaultExtra: { raw: 2, formatted: '2.00', legendSizingLabel: '2.00' },
isSeriesHidden: true,
defaultExtra: { raw: 6, formatted: '6.00', legendSizingLabel: '6.00' },
isSeriesHidden: true,
},
{
color: '#2B70F7',
label: 'b',
seriesIdentifier: {
key: 'specId:{bars},colors:{b}',
specId: 'bars',
},
];
expect(isAllSeriesDeselected(legendItems1)).toBe(true);
});
test('displays data availble if chart is not empty', () => {
const legendItems2: LegendItem[] = [
{
color: '#1EA593',
label: 'a',
seriesIdentifier: {
key: 'specId:{bars},colors:{a}',
specId: 'bars',
},
defaultExtra: { raw: 6, formatted: '6.00', legendSizingLabel: '6.00' },
isSeriesHidden: false,
defaultExtra: { raw: 2, formatted: '2.00', legendSizingLabel: '2.00' },
isSeriesHidden: true,
},
];
expect(isAllSeriesDeselected(legendItems1)).toBe(true);
});
test('displays data availble if chart is not empty', () => {
const legendItems2: LegendItem[] = [
{
color: '#1EA593',
label: 'a',
seriesIdentifier: {
key: 'specId:{bars},colors:{a}',
specId: 'bars',
},
{
color: '#2B70F7',
label: 'b',
seriesIdentifier: {
key: 'specId:{bars},colors:{b}',
specId: 'bars',
},
defaultExtra: { raw: 2, formatted: '2.00', legendSizingLabel: '2.00' },
isSeriesHidden: true,
defaultExtra: { raw: 6, formatted: '6.00', legendSizingLabel: '6.00' },
isSeriesHidden: false,
},
{
color: '#2B70F7',
label: 'b',
seriesIdentifier: {
key: 'specId:{bars},colors:{b}',
specId: 'bars',
},
];
expect(isAllSeriesDeselected(legendItems2)).toBe(false);
});
defaultExtra: { raw: 2, formatted: '2.00', legendSizingLabel: '2.00' },
isSeriesHidden: true,
},
];
expect(isAllSeriesDeselected(legendItems2)).toBe(false);
});
});
12 changes: 7 additions & 5 deletions src/chart_types/xy_chart/state/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable jest/no-conditional-expect */

import { MockSeriesCollection } from '../../../../mocks/series/series_identifiers';
import { MockSeriesSpecs, MockSeriesSpec, MockGlobalSpec } from '../../../../mocks/specs';
Expand Down Expand Up @@ -235,15 +237,15 @@ describe('Chart State utils', () => {
'groupId{__global__}spec{bar1}yAccessor{y}splitAccessors{g-b}smV{__ECH_DEFAULT_SINGLE_PANEL_SM_VALUE__}smH{__ECH_DEFAULT_SINGLE_PANEL_SM_VALUE__}';

describe('empty series collection and specs', () => {
it('it should return an empty map', () => {
it('should return an empty map', () => {
const actual = getCustomSeriesColors(MockSeriesSpecs.empty(), MockSeriesCollection.empty());

expect(actual.size).toBe(0);
});
});

describe('series collection is not empty', () => {
it('it should return an empty map if no color', () => {
it('should return an empty map if no color', () => {
const barSpec1 = MockSeriesSpec.bar({ id: specId1, data, splitSeriesAccessors: ['g'] });
const barSpec2 = MockSeriesSpec.bar({ id: specId2, data, splitSeriesAccessors: ['g'] });
const barSeriesSpecs = MockSeriesSpecs.fromSpecs([barSpec1, barSpec2]);
Expand All @@ -253,7 +255,7 @@ describe('Chart State utils', () => {
expect(actual.size).toBe(0);
});

it('it should return string color value', () => {
it('should return string color value', () => {
const color = 'green';
const barSpec1 = MockSeriesSpec.bar({ id: specId1, data, color });
const barSpec2 = MockSeriesSpec.bar({ id: specId2, data });
Expand All @@ -276,7 +278,7 @@ describe('Chart State utils', () => {
const barSeriesSpecs = MockSeriesSpecs.fromSpecs([barSpec1, barSpec2]);
const barSeriesCollection = MockSeriesCollection.fromSpecs(barSeriesSpecs);

it('it should return color from color array', () => {
it('should return color from color array', () => {
const actual = getCustomSeriesColors(barSeriesSpecs, barSeriesCollection);

expect(actual.size).toBe(4);
Expand Down Expand Up @@ -310,7 +312,7 @@ describe('Chart State utils', () => {
const barSeriesSpecs = MockSeriesSpecs.fromSpecs([barSpec1, barSpec2]);
const barSeriesCollection = MockSeriesCollection.fromSpecs(barSeriesSpecs);

it('it should return color from color function', () => {
it('should return color from color function', () => {
const actual = getCustomSeriesColors(barSeriesSpecs, barSeriesCollection);
expect(actual.size).toBe(1);
expect(actual.get(targetKey)).toBe('aquamarine');
Expand Down

0 comments on commit 68065a7

Please sign in to comment.