emberjs/ember-test-helpers

Create a new helper ("getCurrentPathName" or similar) to better deal with "toc_routing-transition-methods" deprecation ?

Opened this issue · 1 comments

Hi !

According to this deprecation 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)

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 🤔

Sorry for the delayed response here, I'm not 100% sure what the goal of the new helper would actually be. Can you give me a couple of example inputs/outputs?