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

143
Views
Jest testing components and undefined values inside .toHaveBeenCalledWith

Jest testing components and undefined values inside .toHaveBeenCalledWith

Having issues testing that a value exists in cases where the value is a component or undefined (toolbarComponent). Is there a way to test these values without using jest-extended? I saw that expect.anything() doesnt work for an undefined value, but I dont know why expect.anything() doesnt work for a component.

  expect(worklistMock).toHaveBeenCalledWith(
  expect.objectContaining({​
    overflowColumns: expect.arrayContaining([
      expect.objectContaining({​ columnKey: 'order-category' }​),
      expect.objectContaining({​ columnKey: 'order-date' }​),
      expect.objectContaining({​ columnKey: 'order-due-date' }​),
      expect.objectContaining({​ columnKey: 'ordering-location' }​),
      expect.objectContaining({​ columnKey: 'ordering-provider' }​),
    ]),
    pinnedColumns: expect.arrayContaining([
      expect.objectContaining({​ columnKey: 'demog-patient-information' }​),
      expect.objectContaining({​ columnKey: 'outstanding-order' }​),
    ]),
    worklistId: 'OrderTrackingWorklist',
    toolbarComponent: expect.anything(),
    placeHolderComponent: expect.anything(),
  }​),
  expect.anything(),
);

toolbarComponent in the Error:

Expected: "toolbarComponent": Anything

Received "toolbarComponent": <OrderTrackingWorklistToolbar deleteWorklist={​​​​​​[Function deleteWorklist]}​​​​​​ disabled={​​​​​​true}​​​​​​ saveWorklist={​​​​​​[Function saveWorklist]}​​​​​​ savedWorklists={​​​​​​{​​​​​​"lastUpdated": "", "selectedWorklist": "", "worklists": []}​​​​​​}​​​​​​ selectWorklist={​​​​​​[Function selectWorklist]}​​​​​​ />,

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!