UNPKG

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