1 | const React = require('react');
|
2 | const { expect } = require('chai');
|
3 | const { shallow } = require('enzyme');
|
4 | const { MaxKey, MinKey } = require('bson');
|
5 | const { KeyValue } = require('../');
|
6 |
|
7 | describe('<KeyValue />', () => {
|
8 | context('when the value is a MaxKey', () => {
|
9 | const value = new MaxKey();
|
10 | const component = shallow(<KeyValue type="MaxKey" value={value} />);
|
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-maxkey')).to.equal(true);
|
18 | });
|
19 |
|
20 | it('sets the title', () => {
|
21 | expect(component.props().title).to.equal('MaxKey()');
|
22 | });
|
23 |
|
24 | it('sets the value', () => {
|
25 | expect(component.text()).to.equal('MaxKey()');
|
26 | });
|
27 | });
|
28 |
|
29 | context('when the value is a MinKey', () => {
|
30 | const value = new MinKey();
|
31 | const component = shallow(<KeyValue type="MinKey" value={value} />);
|
32 |
|
33 | it('sets the base class', () => {
|
34 | expect(component.hasClass('element-value')).to.equal(true);
|
35 | });
|
36 |
|
37 | it('sets the type class', () => {
|
38 | expect(component.hasClass('element-value-is-minkey')).to.equal(true);
|
39 | });
|
40 |
|
41 | it('sets the title', () => {
|
42 | expect(component.props().title).to.equal('MinKey()');
|
43 | });
|
44 |
|
45 | it('sets the value', () => {
|
46 | expect(component.text()).to.equal('MinKey()');
|
47 | });
|
48 | });
|
49 | });
|