I started first time to test my vuejs application. In my application I have a list of clients, and when you click on client, you go to that clients page, which I am try to test right now. But my test fails before I started with this error:
TypeError: Cannot read properties of undefined (reading 'params')
created() {
this.clientid = this.$route.params.id;
^
this.getClient();
}
I tried to set this into my test:
describe('Client', () => {
it('should mount Client', () => {
const wrapper = mount(Client, {
data: () => ({
route: {
params: {
id: ''
}
},
}),
});
expect(wrapper.exists()).toBe(true);
});
});
Can you help me understand how to give this params a value through the test?