1 | const React = require('react');
|
2 | const { expect } = require('chai');
|
3 | const { shallow } = require('enzyme');
|
4 | const { Code } = require('bson');
|
5 | const { CodeValue } = require('../');
|
6 |
|
7 | describe('<CodeValue />', () => {
|
8 | const code = new Code('this.a > i', { i: 1 });
|
9 | const component = shallow(<CodeValue type="Code" value={code} />);
|
10 | const value = 'Code(\'this.a > i\', {"i":1})'
|
11 |
|
12 | it('sets the base class', () => {
|
13 | expect(component.hasClass('element-value')).to.equal(true);
|
14 | });
|
15 |
|
16 | it('sets the type class', () => {
|
17 | expect(component.hasClass('element-value-is-code')).to.equal(true);
|
18 | });
|
19 |
|
20 | it('sets the title', () => {
|
21 | expect(component.props().title).to.equal(value);
|
22 | });
|
23 |
|
24 | it('sets the value', () => {
|
25 | expect(component.text()).to.equal(value);
|
26 | });
|
27 | });
|
28 |
|
\ | No newline at end of file |