ManageIQ/manageiq-ui-classic

View on GitHub
app/javascript/spec/miq-condition/miq-condition-spec.js

Summary

Maintainability
C
1 day
Test Coverage
import React from 'react';
import toJson from 'enzyme-to-json';
import { shallow } from 'enzyme';
import MiqStructuredList from '../../components/miq-structured-list';
import {
  infoData, conditionsScopeData, conditionsExpressionData, conditionPoliciesData, conditionNotes,
} from './miq-condition.data';

describe('MiqConditionStructuredList', () => {
  it('should render condition info structured list', () => {
    const wrapper = shallow(<MiqStructuredList
      rows={infoData.items}
      title={infoData.title}
      mode={infoData.mode}
    />);
    expect(toJson(wrapper)).toMatchSnapshot();
  });

  it('should render condition scope structured list', () => {
    const wrapper = shallow(<MiqStructuredList
      rows={conditionsScopeData.items}
      title={conditionsScopeData.title}
      mode={conditionsScopeData.mode}
    />);
    expect(toJson(wrapper)).toMatchSnapshot();
  });

  it('should render condition expression structured list', () => {
    const wrapper = shallow(<MiqStructuredList
      rows={conditionsExpressionData.items}
      title={conditionsExpressionData.title}
      mode={conditionsExpressionData.mode}
    />);
    expect(toJson(wrapper)).toMatchSnapshot();
  });

  it('should render condition policy structured list', () => {
    const wrapper = shallow(<MiqStructuredList
      rows={conditionPoliciesData.items}
      title={conditionPoliciesData.title}
      mode={conditionPoliciesData.mode}
    />);
    expect(toJson(wrapper)).toMatchSnapshot();
  });

  it('should render condition notes structured list', () => {
    const wrapper = shallow(<MiqStructuredList
      rows={conditionNotes.items}
      title={conditionNotes.title}
      mode={conditionNotes.mode}
    />);
    expect(toJson(wrapper)).toMatchSnapshot();
  });
});