mercredi 25 septembre 2019

Angular jasmine toHaveBeenCalledWith with queryParams not working

I have this test:

it('should redurect to admin programs', () => {
    ...

    expect(navigateSpy).toHaveBeenCalledWith(['/admin/programs', {queryParams: {pub_status: 'active'}}]);
});

And its throwing this error:

Error: Expected spy navigate to have been called with 
[ [ '/admin/programs', Object({ queryParams: Object({ pub_status: 'active' }) }) ] ] but actual calls were 
[ [ '/admin/programs' ], Object({ queryParams: [ pub_status: 'active' ] }) ].

How do I solve it? This annotation is very strange:

{ queryParams: [ pub_status: 'active' ] } <-- wtf this is not a proper array

Thanks!!

Aucun commentaire:

Enregistrer un commentaire