Skip to content

Elmish tutorial: mount test errors #31

Open
@lederle

Description

I discovered some errors in the elmish.md walkthrough at the mount step. To be clear, when I run the tests for the final version of elmish.js as given in the repo, everything passes, so these errors are against an intermediate step in the text of elmish.md only.

  1. Entering the code as given through the mount implementation section produces the following:

Screenshot from 2021-02-11 19-48-05

This stems from the test call to elmish.mount. It looks as if the order of the arguments to view are in the wrong order; the instances specifically are: a) the call to view in the mount function within the elmish.md text and b) in the counter.js declaration of view. The arity of the call compared to the declaration also differs.

FWIW, to fix I switched the order of the args in counter.js (the final version of elmish.js seemed to indicate that was the way). This eliminates the TypeError for 'signal not a function', but running the tests leads to another error:

  1. The first test for the assert against the state of the counter fails, and the button seems not to be in the (js)DOM:

Screenshot from 2021-02-11 20-34-36

The view function returns a container, but it doesn't seem to be appended? When I call document.appendChild on each of the two calls to view in mount, the tests pass.

I am on Ubuntu 20.04, node 14.15.1.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions