Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
How to trigger functions with wrapped mounted components JEST

So I am trying to add unit tests to my FUNCTIONAL components.

I am using react-redux + redux-saga in my application.

Component That I want to test:

enter image description here

This is the test that I have it right now

    const store = mockStore(state);

    wrapper = mount(
       <Provider store={ store }>
          <ItemTab />
       </Provider>
    );

In my component ItemTab.js I have this function

    function test() {
       console.log('testing')
    }

And in my ItemTab.test.js I am calling this test

describe('ItemTab', () => {
    it('first test', () => {
        wrapper.test()
    });
})

And If I do that I have this error wrapper.test is not a function

Notes:

  1. I tried using the dive() property but it doesn't seem to be working from me.
  2. I can't use shallow instead but the wrapper.instance() is always giving me null

So my questions are:

  1. How can I test a functional component with redux + redux-saga?
  2. How can I trigger a function inside a component without trying to find a button so I can trigger a simulation?
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!