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