Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be used in integration tests (setupRenderingTest) #126

Closed
buschtoens opened this issue Aug 28, 2019 · 1 comment · Fixed by #127
Closed

Cannot be used in integration tests (setupRenderingTest) #126

buschtoens opened this issue Aug 28, 2019 · 1 comment · Fixed by #127

Comments

@buschtoens
Copy link
Owner

The <LinkTo> component is backed by the private -routing service, which has explicit short-circuit logic to detect when it is being run in an integration / render test.

When you use <Link> in a render test, you currently get this error:

Uncaught (in promise) TypeError: Cannot read property 'generate' of undefined
    at Class.generate (router.js:479)
    at RouterService.urlFor (router.js:200)
    at LinkComponent.get href [as href] (component.js:78)
    at getPossibleMandatoryProxyValue (metal.js:2532)
    at get (metal.js:2612)
    at glimmer.js:507
    at track (metal.js:2498)
    at RootPropertyReference.compute (glimmer.js:506)
    at RootPropertyReference.value (glimmer.js:374)
    at ComponentElementOperations.flush (runtime.js:1584)

This is because RouterService#urlFor delegates to the system's Router#generate method, which expects _routerMicrolib to be initialized, which it is only in application / acceptance tests.

/cc @Charizard

@buschtoens
Copy link
Owner Author

Fixed in v1.0.2! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant