-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathshell-output.spec.tsx
33 lines (27 loc) · 1.34 KB
/
shell-output.spec.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import { expect } from '../../testing/chai';
import { shallow } from '../../testing/enzyme';
import type { ShellOutputEntry } from './shell-output-line';
import { ShellOutputLine } from './shell-output-line';
import { ShellOutput } from './shell-output';
describe('<ShellOutput />', function () {
it('renders no output lines if none are passed', function () {
const wrapper = shallow(<ShellOutput output={[]} />);
expect(wrapper.find(ShellOutputLine)).to.have.lengthOf(0);
});
it('renders an output line if one is passed', function () {
const line1: ShellOutputEntry = { type: 'output', value: 'line 1' };
const wrapper = shallow(<ShellOutput output={[line1]} />);
expect(wrapper.find(ShellOutputLine)).to.have.lengthOf(1);
});
it('renders no output lines if only one with a value of undefined is passed', function () {
const line1: ShellOutputEntry = { type: 'output', value: undefined };
const wrapper = shallow(<ShellOutput output={[line1]} />);
expect(wrapper.find(ShellOutputLine)).to.have.lengthOf(0);
});
it('pass the entry to the output line as prop', function () {
const line1: ShellOutputEntry = { type: 'output', value: 'line 1' };
const wrapper = shallow(<ShellOutput output={[line1]} />);
expect(wrapper.find(ShellOutputLine).prop('entry')).to.deep.equal(line1);
});
});