UNPKG

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