Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import { expect } from 'chai';
import { describeWithDOM, mount, shallow } from 'enzyme';
import ReactDOM from 'react-dom';
import sinon from 'sinon';
import classify from '../../src/classify';
describeWithDOM('lifecycleFunctions', () => {
it('receives props', () => {
const content = 'hello';
const [Text, WrappedText] = createTextComponent();
shallow();
expect(Text).to.have.been
.calledOnce.and
.calledWith({ content });
});
it('uses componentWillMount', () => {
testNoExtraArgs('componentWillMount', { render: shallow });
});
it('uses componentDidMount', () => {
});
it('should call setComponentProperties on control input changes', () => {
const properties = {
age: ,
};
const callback = spy();
const result = renderControls(properties, { age: 22 }, callback);
const controls = shallow(result[0]);
controls.find('input').simulate('change', { target: { value: 32 } });
expect(callback).to.have.been.calledOnce;
expect(callback).to.have.been.calledWith({ age: 32 });
});
describeWithDOM('nested control', () => {
it('should call setComponentProperties on input changes', () => {
const properties = {
foo: {
bar: ,
},
};
const callback = spy();
const result = renderControls(properties, { foo: { bar: 22 } }, callback);
const controls = mount(result[0]);
controls.find('input').simulate('change', { target: { value: 32 } });
expect(callback).to.have.been.calledOnce;
expect(callback).to.have.been.calledWith({ foo: { bar: 32 } });
});
});
});
describe('(Component) CommentContainer', () => {
it('renders as a div', () => {
const wrapper = shallow();
const spy = sinon.spy();
expect(wrapper.type()).to.eql('div');
});
describeWithDOM('Lifecycle methods', () => {
it('calls component did mount', () => {
spyLifecycle(CommentContainer);
mount();
expect(
CommentContainer.prototype.componentDidMount.calledOnce
).to.be.true;
});
});
});