Sha256: 56b772ff460aa75cb91afc76a97a4c3ffe1f537a194aa53ff41d9817a0c3a81f
Contents?: true
Size: 1.23 KB
Versions: 43
Compression:
Stored size: 1.23 KB
Contents
import React from 'react'; import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils'; import { mount } from 'enzyme'; 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
43 entries across 43 versions & 2 rubygems