Am trying to write a test case for a component. Test cases are getting passed. But JS lint is bugging me. Its throwing an error - :Expected an assignment or function call and instead saw an expression
The error is coming here : expect(dummyOutput.find('h1.screen-reader-text')).to.exist;
My complete testcase code is as below. Can anyone help me here to solve the error please?
import React from 'react';
import { shallow } from 'enzyme';
import Page from './page';
const props = {
pageLayout: 'article',
theme: 'test-theme',
header: {},
footer: {},
singleAds: {},
siteMeta: { copyright_text: '©COPYRIGHT CONTENT HERE' },
};
const dummyProps = {
pageLayout: 'dummy_text',
theme: 'test-theme',
header: {},
footer: {},
singleAds: {},
siteMeta: { copyright_text: '©COPYRIGHT CONTENT HERE' },
};
const specs = () => describe('Page Layout', () => {
describe('Renders', () => {
const wrapper = shallow(<Page {...props} />);
const dummyOutput = shallow(<Page {...dummyProps} />);
it.only('should not return H1 tag', () => {
expect(wrapper.find('h1.screen-reader-text')).not.exist;
});
it.only('should return H1 tag', () => {
expect(dummyOutput.find('h1.screen-reader-text')).to.exist;
});
});
});
if (process.env.NODE_ENV === 'test') {
specs();
}
export default specs;