-
Notifications
You must be signed in to change notification settings - Fork 40
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
Anything with Browser.Navigation.Key cannot be tested #24
Comments
If you are testing a function that calls |
I don't think this is necessarily for effect testing, but for anything that takes a model. So for example, when testing a view, that typically has a signature |
In our case, we have two scenarios where we need this:
|
Ah. Having You can also play around with record parameters, though I doubt this is news:
|
I'm having a similar issue. I want to make sure that my EDIT: Just realized I can’t generally compare Platform.Cmd’s, so that whole idea that I’d make sure that my main returns the right things seems to be doomed. |
One can compare The other option to the approach #24 (comment) is to have a model with |
Just a quick update: we're working on designs for a possible API to address this! |
…e. Unfortunately, `Navigation.Key` is passed in from the runtime and there’s no way to create a testing stub for it currently. See elm-explorations/test#24 for updates.
…e. Unfortunately, `Navigation.Key` is passed in from the runtime and there’s no way to create a testing stub for it currently. See elm-explorations/test#24 for updates.
…e. Unfortunately, `Navigation.Key` is passed in from the runtime and there’s no way to create a testing stub for it currently. See elm-explorations/test#24 for updates.
…e. Unfortunately, `Navigation.Key` is passed in from the runtime and there’s no way to create a testing stub for it currently. See elm-explorations/test#24 for updates.
Is there any news on this? |
I'm also hitting my head against the wall. Just added routes to my app using I'm considering opening a PR to update the README for this project and elm/browser so other devs are warned before investing their time in these libraries. Is that a good idea? |
Somebody pointed me to this interesting branch. |
Any updates? |
This was recently released: https://package.elm-lang.org/packages/avh4/elm-program-test/3.1.0/ |
That's already something, but still requires to change production code for tests. |
I'm just upgrading to 0.19 at the moment and hitting this problem. I can't help feeling the situation is a bit crazy. |
Agreed with others on this thread. One of the benefits of FP is that testing should be easy so not providing any way to get a dummy key for testing seems like a real problem. Any further work being done on the PR above? |
I'm also in the same situation. |
Elmer provides (Edit: and it means putting a function in your model, which is bad practice and IIRC limits the functionality of the debugger.) |
Any updates? |
2 similar comments
Any updates? |
Any updates? |
While not a solution to the fundamental issue imposed by the src: https://github.com/avh4/elm-program-test/blob/main/examples/src/NavigationKeyExample.elm |
The brian-watkins/elm-spec package actually supports initialising my app. I can't do this in elm-test due to `Browser.Navigation.Key` being inaccessible - see elm-explorations/test#24
Any updates? @rtfeldman |
No updates, sorry! |
When using Browser.application I will put the Key in my model for later use.
When testing I want to create a model, but I don't have a way to get a Key.
So I cannot test functions that take my Model.
Can test provide a way to get a navigation key?
Originally opened this here elm/browser#30
The text was updated successfully, but these errors were encountered: