I have most of the test running correctly, but based on the test, my match props seems wrong. I have 3 other props and they are all passing.
Here is what i have so far:
EditUser.test.js
describe('EditUser', () => {
let tree;
let baseProps;
let mockmatch = {
params: {
id:{
URLParams: "test edit user and add user"
},
type: "test",
}
};
beforeEach(() => {
baseProps = {
match: mockmatch
}
})
it (' Should render without a mockmatch props',() => {
baseProps = {
...baseProps,
match: {},
};
tree = renderer.create(<EditUser {...baseProps } />)
let treeJson = tree.toJSON();
expect(treeJson).toMatchSnapshot();
tree.unmount()
});
EditUser.js :
this is the location of the error, right under render()
render() {
let URLParams = this.props.match.params;
let title = URLParams.id ? 'Edit User' : 'Add User';
let type = URLParams.type;