1 | const React = require('react');
|
2 | const { Double } = require('bson');
|
3 | const { expect } = require('chai');
|
4 | const { shallow } = require('enzyme');
|
5 | const { DoubleValue } = require('../');
|
6 |
|
7 | describe('<DoubleValue />', () => {
|
8 | describe('with a driver value', function() {
|
9 | const value = new Double(123.45);
|
10 | const component = shallow(<DoubleValue type="Double" 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-double')).to.equal(true);
|
18 | });
|
19 |
|
20 | it('sets the title', () => {
|
21 | expect(component.props().title).to.equal('123.45');
|
22 | });
|
23 |
|
24 | it('sets the value', () => {
|
25 | expect(component.text()).to.equal('123.45');
|
26 | });
|
27 | });
|
28 |
|
29 | describe('with a primative value', function() {
|
30 | const value = 123.45;
|
31 | const component = shallow(<DoubleValue type="Double" 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-double')).to.equal(true);
|
39 | });
|
40 |
|
41 | it('sets the title', () => {
|
42 | expect(component.props().title).to.equal('123.45');
|
43 | });
|
44 |
|
45 | it('sets the value', () => {
|
46 | expect(component.text()).to.equal('123.45');
|
47 | });
|
48 | });
|
49 | });
|