Skip to content

Router Example Expansion #153

Closed
Closed
@ReshmiCode

Description

@ReshmiCode

I just came across this library, I used the original for a React project and I'm trying to expand it to our Angular project! I'm having some issues testing routing. Could the current routing example be expanded to show how to check if the href has been navigated too? I tried following a bunch of examples from other sources but they did not work.

Currently, in my render function for the test I add routes: [{ path: 'reset/request', component: BlankComponent }] and then in the test I currently have:
const navSpy = jest.spyOn(Router.prototype, 'navigate'); await initialState.navigate(screen.getByText(/forgot password/i)); expect(navSpy).toHaveBeenCalledWith(['/reset/request']);

I tried a bunch of things with location.href and this is the closest I got to it working, but the test is failing because the spy is apparently called with "{"queryParams": undefined}". The correct way to test this with the library would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions