we need to get a list of all route names from router.js in a test. preferably a lower level test (unit/integration).
use case for context: we have metadata that is required for all routes. this test is to make sure that the appropriate metadata was added, and not forgotten, when a new route is added.
similar questions here and here have been asked, but attempts to adopt/modify those solutions within a test have not been fruitful.
here's how I've managed to do it in an acceptance test.
here's what I don't like about this solution:
the private APIs are used in ember-inspector though, so if it breaks in the future, we should be able to reference whatever they've changed in that repo.
the test only asserts that we have route names. for the original use case, it is trivial to change this code to iterate over
routeNames.the need to call
setupRouter()was found via this issue