Mocha Test Case

Mocha Test Case
0.0 0

#1

React Test case For Component:

I am trying write a test case which calls a function in .jsx file passing object as argument from spec.js file for a react component.

Below is the code:
it(‘should render without problems OverlayAddExtraSimComponent restrictedtemplate type’, () => {
let overlayAddExtraSimObj = {code:‘AddOneExtraSimChange_ProductChangeButtons_TechnicalCategorization’},
overlayAddExtraSimVal;

	overlayAddExtraSimVal =  addExtraSim._restrictedToBundleTemplate(overlayAddExtraSimObj);
	expect(overlayAddExtraSimVal).to.match('AddOneExtraSimChange');

});

FAILED TESTS:
OverlayAddExtraSim Component
× should render without problems OverlayAddExtraSimComponent restrictedtempl
ate type
PhantomJS 2.1.1 (Windows 7 0.0.0)
undefined is not a constructor (evaluating ‘re.exec(obj)’)
assertMatch@node_modules/chai/chai.js:1364:16
node_modules/chai/chai.js:4192:30
webpack:///src/components/overlay/overlay-add-extra-sim/overlay-add-extra-si
m.spec.js:45:41 <- test/loadtests.js:279945:41

Kindly let me know, what could be the cause for this error and solution for it. Thanks in Advance.