UNPKG

822 BJSXView Raw
1const React = require('react');
2const { expect } = require('chai');
3const { shallow } = require('enzyme');
4const { ObjectId } = require('bson');
5const { Value } = require('../');
6
7describe('<Value /> (rendering ObjectId)', () => {
8 const value = ObjectId.createFromHexString('583711146b59b28fcfa66587');
9 const component = shallow(<Value type="ObjectId" 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-objectid')).to.equal(true);
17 });
18
19 it('sets the title', () => {
20 expect(component.props().title).to.equal('583711146b59b28fcfa66587');
21 });
22
23 it('sets the value', () => {
24 expect(component.text()).to.equal('583711146b59b28fcfa66587');
25 });
26});
27
\No newline at end of file