Sha256: 168f936b57fb916020f9ebff4a43fad504cfdff4b10665deaa3107edd8a1e5f1

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';

import {
  preupgradeReports,
  reportsWithRemediations,
} from './PreupgradeReports.fixtures';

import {
  flattenEntries,
  isEmpty,
  entryFixable,
  anyEntriesFixable,
  idsForInvocation,
  entriesPage,
} from '../PreupgradeReportsHelpers';

const fixtures = {
  'should return flattened entrues': () => flattenEntries(preupgradeReports),
  'should detect empty object': () => isEmpty({}),
  'should detect non-empty object': () => isEmpty({ foo: 'bar' }),
  'should detect entry is fixable': () =>
    entryFixable({ detail: { remediations: [{ type: 'command' }] } }),
  'should detect entry is not fixable when not having a command': () =>
    entryFixable({ detail: { remediations: [{ type: 'hint' }] } }),
  'should detect entry is not fixable when not having remediations': () =>
    !!entryFixable({ detail: {} }),
  'should detect no entry is fixable': () =>
    anyEntriesFixable(preupgradeReports),
  'should detect a fixable entry in reports': () =>
    anyEntriesFixable(reportsWithRemediations),
  'should collect ids for job invocation': () =>
    idsForInvocation(preupgradeReports),
  'should return entries page': () =>
    entriesPage(flattenEntries(preupgradeReports), { page: 2, perPage: 3 }),
};

describe('PreupgradeReportsHelpers', () =>
  testSelectorsSnapshotWithFixtures(fixtures));

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_leapp-0.0.6 webpack/components/PreupgradeReports/__tests__/PreupgradeReportsHelpers.test.js