UNPKG

781 BJSXView Raw
1const React = require('react');
2const { expect } = require('chai');
3const { shallow } = require('enzyme');
4const { Code } = require('bson');
5const { CodeValue } = require('../');
6
7describe('<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