avh4 / avh4/elm-testable

Cannot use this with ports

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
42
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Hello, this is an awesome package, unfortunately I can't use this because I have outgoing ports, and ports can only return `Cmd a` or `Sub a`, using `Testable.Cmd.Cmd a` throws an error:

``` elm
port requestDownloadHead : HeadHash -> Testable.Cmd.Cmd a
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You are saying it should be:

Account.Model.HeadHash -> Testable.Cmd.Cmd a

But you need to use the particular format described here:

```

And although I don't need elm-testable to test outgoing ports (because I can do [like this](https://github.com/rogeriochaves/elm-peer-tweet/blob/90d6f5cdcdfdedb1a1decb3ee30d6d4d673dac32/test/Download/CmdSpec.elm#L23)), I want to mix Cmds for ports and tasks and still be able to test them.

My suggestion would be to add an extra type for Testable.Cmd, like `PortCmd`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the Elm effect managers guide and inspecting Testable.Cmd.Cmd, then compare the linked Download/CmdSpec.elm example. Done means outgoing port commands can be represented alongside task commands without the type error, while remaining testable.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.