Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Jest test assertion, expect a nested object

$
0
0

When I do the below expect in jest with native test

expect(mockOnChange).toHaveBeenCalledWith({     order_type: expect.arrayContaining(['1']),     number: '',     ouser_ids: expect.arrayContaining(['user_id1']),     payment_type: expect.arrayContaining(['2']),     start_date: old_Date,     end_date: current_date,     state: 'all',    });

I'm getting the following error

   Object {"end_date": "2022/06/07","number": "",            -   "order_type": ArrayContaining [+"order_type": Array ["1",                ],            -   "ouser_ids": ArrayContaining [+"ouser_ids": Array ["user_id1",            -   ],            -   "payment_type": ArrayContaining [            -     "2",                ],+"payment_type": Array [],"start_date": "2022/06/01","state": "all",              },

I have also tried without expect.arrayContaining() still getting the same errorI'm I doing this wrong?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>