emberjs / emberjs/ember-test-helpers
Create a new helper ("getCurrentPathName" or similar) to better deal with "toc_routing-transition-methods" deprecation ?
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
Hi !
According to [this deprecation](https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods) I started to replace some calls to `replaceRoute` & `transitionToRoute` by calls on `router` service on my ember App...
The result was a lot of failing test (mainly test using `getCurrentURL` helper) because of URL now includes Query Params :
> Calling transitionTo from the Router service will cause default query parameter values to be included in the URL.
(see [RouterService `transitionTo` documentation](https://api.emberjs.com/ember/3.22/classes/RouterService/methods/transitionTo?anchor=transitionTo))
On some test, I replaced the `getCurrentURL` by `getCurrentRouteName` helper & it works great.
But for some tests, I can't because I need to test the route, but also the dynamic segment value like :
```
assert.equal(
getCurrentURL(),
`a/route/with/${model_id}/model`,
"..."
)
```
What I've done to fix this, is create a new helper returning only the pathName of the current URL.
So I'm wonder if a such helper could be implemented here as a part of `ember-test-helpers` ?
I can create a PR for this, but just want to be sure it's a good idea before working on it :thinking:
Contributor guide
Assessment
This issue has not been assessed yet.