Sha256: 1f9ac4a7a5f2a86b566641a7b905932e4243f1e91fb2137406bc577df8a898c1

Contents?: true

Size: 1.2 KB

Versions: 22

Compression:

Stored size: 1.2 KB

Contents

import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';

import { TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY } from './TasksDonutChartConstants';
import TasksDonutChart from './TasksDonutChart';

jest.mock('./TasksDonutChartHelper', () => ({
  shouleBeSelected: focusedOn => focusedOn !== 'normal' && focusedOn !== 'none',
  getBaseChartConfig: jest.fn(() => ({ base: 'some-base-config' })),
  createChartData: jest.fn(() => ({
    columns: 'some-columns',
    names: 'some-names',
    onItemClick: jest.fn(),
  })),
  updateChartTitle: jest.fn(),
}));

const createRequiredProps = () => ({ last: 3, older: 5 });

const fixtures = {
  'render with minimal props': { ...createRequiredProps() },
  'render with props': {
    ...createRequiredProps(),
    className: 'some-class',
    time: 'time-period',
    colorsPattern: ['color1', 'color2'],
    onTotalClick: jest.fn(),
    onLastClick: jest.fn(),
    onOlderClick: jest.fn(),
  },
};

TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY.forEach(mode => {
  fixtures[`render with focused-on ${mode}`] = {
    ...createRequiredProps(),
    focusedOn: mode,
  };
});

describe('TasksDonutChart', () =>
  testComponentSnapshotsWithFixtures(TasksDonutChart, fixtures));

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman-tasks-0.15.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js
foreman-tasks-0.15.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js