Sha256: 166567a1ff04bcd1b4e45851891a03d984107376f6d845d7883b24b13c420400

Contents?: true

Size: 991 Bytes

Versions: 92

Compression:

Stored size: 991 Bytes

Contents

import {
  getQueryKeyText,
  getQueryValueText,
  timeToHoursNumber,
} from '../TasksDashboardHelper';
import {
  TASKS_DASHBOARD_AVAILABLE_TIMES,
  TASKS_DASHBOARD_QUERY_KEYS_TEXT,
  TASKS_DASHBOARD_QUERY_VALUES_TEXT,
} from '../TasksDashboardConstants';

const { H12, H24, WEEK } = TASKS_DASHBOARD_AVAILABLE_TIMES;

describe('TasksDashboard - helpers', () => {
  it('should getQueryKeyText', () => {
    Object.entries(TASKS_DASHBOARD_QUERY_KEYS_TEXT).forEach(([key, value]) => {
      expect(getQueryKeyText(key)).toBe(value);
    });
  });

  it('should getQueryValueText', () => {
    Object.entries(TASKS_DASHBOARD_QUERY_VALUES_TEXT).forEach(
      ([key, value]) => {
        expect(getQueryValueText(key)).toBe(value);
      }
    );
  });

  it('should timeToHoursNumber', () => {
    expect(timeToHoursNumber(H12)).toBe(12);
    expect(timeToHoursNumber(H24)).toBe(24);
    expect(timeToHoursNumber(WEEK)).toBe(7 * 24);

    expect(timeToHoursNumber('other')).toBe(24);
  });
});

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
foreman-tasks-10.0.2 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-10.0.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-10.0.0 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.2.3 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.2.2 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.2.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.2.0 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.1.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.0.4 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.1.0 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.0.2 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.0.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.3.3 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-9.0.0 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.2.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.1.4 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.3.2 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.3.1 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.1.3 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js
foreman-tasks-8.3.0 webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js