Skip to content

RouterLink not using correct href #686

@StevenPewsey

Description

@StevenPewsey

Environment

------------------------------
- Operating System: Darwin
- Node Version:     v18.16.1
- Nuxt Version:     3.8.2
- CLI Version:      3.10.0
- Nitro Version:    2.8.1
- Package Manager:  yarn@3.6.0
- Builder:          -
- User Config:      app, css, build, devServer, modules, runtimeConfig, nitro, vite, i18n, hooks
- Runtime Modules:  @nuxtjs/tailwindcss@6.10.1, @pinia/nuxt@0.4.11, @pinia-plugin-persistedstate/nuxt@1.2.0, @thrivadev/thrive/nuxt@2.1.1, @vueuse/nuxt@10.7.0, @nuxtjs/i18n@8.0.0-rc.9, @vee-validate/nuxt@4.12.2
- Build Modules:    -
------------------------------

Reproduction

https://stackblitz.com/edit/github-tqbkqz

Describe the bug

The mocked RouterLink component is passing props.to directly as the href, however this results in the href being an object when to is an object (e.g. if passing through path and state).

This causes tests to fail even though the links work fine in the browser

- http://localhost:3000/thelink
+ http://localhost:3000/[object%20Object]

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions