Sha256: 64c513f663d614290c7f337a2b8c5520373244eab57ce2cc16bb0f1e7ccc7817

Contents?: true

Size: 1.2 KB

Versions: 30

Compression:

Stored size: 1.2 KB

Contents

import React from 'react';
import { mount, testComponentSnapshotsWithFixtures } from '@theforeman/test';
import Terminal from '../Terminal';
import { props, logs } from '../Terminal.fixtures';

const fixtures = {
  'render without Props': {},
  'render with props': props,
};

describe('Terminal', () => {
  describe('rendering', () =>
    testComponentSnapshotsWithFixtures(Terminal, fixtures));

  it('handles terminal scroll on componentDidUpdate', () => {
    const wrapper = mount(<Terminal {...props} />);
    jest.spyOn(wrapper.instance(), 'scrollBottom');
    wrapper.setProps({ logs: [...logs, 'new-log'] });
    expect(wrapper.instance().scrollBottom).toBeCalled();
  });

  it('error should be displayed in terminal', () => {
    const modifiedProps = { ...props, error: 'some-error' };
    const wrapper = mount(<Terminal {...modifiedProps} />);
    expect(wrapper.find('p.terminal_error').exists()).toBeTruthy();
  });

  it('logs as a string instead of an array should be displayed', () => {
    const text = 'some-string-log';
    const modifiedProps = { ...props, logs: text };
    const wrapper = mount(<Terminal {...modifiedProps} />);
    expect(wrapper.find('.terminal p').text()).toEqual(text);
  });
});

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
foreman_rh_cloud-3.0.21.1 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.21 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.20 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.19 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.18.1 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.18.1 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.18 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.18 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.17 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.17 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.16 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.16 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.15 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.15 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-3.0.14 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.14 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.13.1 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.13 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.12 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
foreman_rh_cloud-2.0.11 webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js