Your environment
Test
API
Version
| library |
version |
| enzyme |
3.11.0 |
| react |
16.13.1 |
| react-dom |
16.13.1 |
| react-test-renderer |
^10.0.4 |
Adapter
I am getting this type of error while executing enzyme test case in React. Below is my test case. Can anyone please help.
context("testing case1", () => {
it("contains correct context notification text", () => {
const date = "2019-05-05"
const testOrder = Object.assign({}, XYZ, { type: ABC, status: A })
const textExpected = abc ${moment(date).format("DD.MM.YYYY")}
expect(renderCtxNotification(testOrder).find("section").text()).to.equal(textExpected)
})
})
const renderCtxNotification = (orderData) => mount(resolveOrderStatusContents(orderData).ctxNotification.renderContents(orderData)
**Below is the error:
Error: Method “text” is meant to be run on 1 node. 0 found instead.
at ReactWrapper.single (node_modules/enzyme/src/ReactWrapper.js:1168:13)
at ReactWrapper.text (node_modules/enzyme/src/ReactWrapper.js:629:17)**
section is present in .jsx file:
<section>
<H4><LocalizedText locKey="text1" /></H4>
<BodyText>
<LocalizedTextWithPlaceholders locKey="text2" placeholders={[formatDate(date)]} />
</BodyText>
</section>
Your environment
Test
API
Version
Adapter
I am getting this type of error while executing enzyme test case in React. Below is my test case. Can anyone please help.
**Below is the error:
Error: Method “text” is meant to be run on 1 node. 0 found instead.
at ReactWrapper.single (node_modules/enzyme/src/ReactWrapper.js:1168:13)
at ReactWrapper.text (node_modules/enzyme/src/ReactWrapper.js:629:17)**
section is present in .jsx file: