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

197
Views
jest test cases are stopping for the component

I am trying to spread two arrays into one. In React, I am looping state array and in that loop for a particular value, I am updating with previous value with another value. But it is making unit test cases are freezing Here is the sample code:

const formValues = [...this.state.formValues];
formValues.forEach((item) => {
if(item.label === 'policy'){
const fieldPermissions = this.props.permissions;
item.value = [...item.value, ...fieldPermissions];
}
})

`

In the above code, I am spreading field emissions and item. value and assigning to item.value, UI is working as expected. But unit test cases are feezing, not running. On removing spreading of item.value, unit test cases are working. Tried different ways to figure it out like concat, array loop, push, etc. Can anyone help me with this?

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!