Reputation: 2762
I have a test
let resultRedirects = {
redirects: {
fromPaths: [
{
path: '/a-good/path',
type: 302
},
{
path: '/goodpath/Rocky%20Mountain%20PBS-HD,%20Create%20and%20V-me.',
type: 301
}
],
toPath: '/shows/default'
}
};
let someFunc = sinon.stub();
let wrapper = shallow(<Settings {...props} />);
wrapper.instance().someFunc2({
target: { value: '302' }
},
0);
expect(someFunc).to.have.been.calledWith(resultRedirects);
The SomeFunc2 content is:
changeRedirectType = (e, index) => {
const {
redirects,
redirects: { fromPaths },
path
} = this.props;
let redirectsFromPaths = [...fromPaths];
redirectsFromPaths[index].type = parseInt(e.target.value);
changeSettings({
redirects: {
...redirects,
toPath: path,
fromPaths: redirectsFromPaths
}
});
};
The response is
AssertionError: expected stub to have been called with arguments {
redirects: { fromPaths: [ [Object], [Object] ], toPath: '/shows/default' }
}
{
redirects: { fromPaths: [ [Object], [Object] ], toPath: '/shows/default' }
}
How can I inspect inside [Object] [Object]
?
Upvotes: 0
Views: 32