mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-23 09:42:49 +03:00
Make Review.Test.expectConfigurationError work without run* functions
This commit is contained in:
parent
d8de5557f1
commit
25cad184d0
@ -1464,16 +1464,13 @@ extractExpectedErrorData ((ExpectedError expectedErrorContent) as expectedError)
|
||||
}
|
||||
|
||||
|
||||
expectConfigurationError : { message : String, details : List String } -> ReviewResult -> Expectation
|
||||
expectConfigurationError expectedError reviewResult =
|
||||
case reviewResult of
|
||||
ConfigurationError configurationError ->
|
||||
expectConfigurationError : { message : String, details : List String } -> Rule -> Expectation
|
||||
expectConfigurationError expectedError rule =
|
||||
case Rule.getConfigurationError rule of
|
||||
Just configurationError ->
|
||||
expectConfigurationErrorDetailsMatch expectedError configurationError
|
||||
|
||||
FailedRun _ ->
|
||||
Expect.fail (FailureMessage.missingConfigurationError expectedError.message)
|
||||
|
||||
SuccessfulRun _ _ ->
|
||||
Nothing ->
|
||||
Expect.fail (FailureMessage.missingConfigurationError expectedError.message)
|
||||
|
||||
|
||||
|
@ -223,16 +223,10 @@ a = Regex.fromString "(abc|"
|
||||
]
|
||||
, test "should report a configuration error when module name is invalid" <|
|
||||
\_ ->
|
||||
"""module A exposing (..)
|
||||
import SomeModule.Regex
|
||||
a = SomeModule.Regex.fromLiteralFunc "^abc$"
|
||||
"""
|
||||
|> Review.Test.runWithProjectData project
|
||||
(rule
|
||||
{ unsafeFunction = "invalid name"
|
||||
, moduleAlias = Nothing
|
||||
}
|
||||
)
|
||||
rule
|
||||
{ unsafeFunction = "invalid name"
|
||||
, moduleAlias = Nothing
|
||||
}
|
||||
|> Review.Test.expectConfigurationError
|
||||
{ message = "invalid name is not a valid function name"
|
||||
, details = [ "Some details" ]
|
||||
|
Loading…
Reference in New Issue
Block a user