-
Notifications
You must be signed in to change notification settings - Fork 0
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
False positives in test functions #89
Comments
You're right sorry. Unluckily it regards code from a private organization so I can't share the repository and despite my efforts I didn't succeed in reproducing a simplified example since I can't find a common pattern. It's a very bizarre case For example in the following situation port module Lib.CookieBar exposing (CookieBar, init, subscriptions, view, update, test)
import Lib.Logger as Logger
...
update : Msg -> CookieBar msg -> ( CookieBar msg, Cmd msg )
update msg model =
case msg of
...
SubError error ->
model
|> PrimaUpdate.withCmds
[ Logger.devConsoleErrorForJsonDecodeError
{ location = "CookieBar subscription port is used wrongly: "
, error = error
}
]
test : Test
test =
Test.describe "Lib.CookieBar tests"
[ updateTest
]
updateTest : Test
updateTest =
Test.describe "Test over update function"
[ Test.test "Tests init state"
(\() ->
init (always ())
|> isVisible
|> Expect.false "Cookie bar should be invisibile at init"
)
] everything works fine. But if I add a test that calls my update: updateTest : Test
updateTest =
Test.describe "Test over update function"
[ Test.test "Tests init state"
(\() ->
init (always ())
|> isVisible
|> Expect.false "Cookie bar should be invisibile at init"
)
, Test.test "Visible flag should be True when cookies acceptance is not present"
(\() ->
init (always ())
|> update (HasCookiesAcceptance False)
|> Tuple.first
|> isVisible
|> Expect.true "Cookie bar should be visible"
)
] Then the rule notices not only that
|
Using "in-module" test configuration if my test is using an
update
function it can happen that rule reports a false positiveThe text was updated successfully, but these errors were encountered: