mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-25 02:34:36 +03:00
Add expectGlobalAndModuleErrors
This commit is contained in:
parent
686e80735d
commit
21ee813aa7
@ -1,7 +1,7 @@
|
||||
module Review.Test exposing
|
||||
( ReviewResult, run, runWithProjectData, runOnModules, runOnModulesWithProjectData
|
||||
, ExpectedError, expectNoErrors, expectErrors, error, atExactly, whenFixed, expectErrorsForModules, expectErrorsForElmJson, expectErrorsForReadme, expectGlobalErrors, globalError
|
||||
, expectGlobalAndLocalErrors
|
||||
, expectGlobalAndLocalErrors, expectGlobalAndModuleErrors
|
||||
)
|
||||
|
||||
{-| Module that helps you test your rules, using [`elm-test`](https://package.elm-lang.org/packages/elm-explorations/test/latest/).
|
||||
@ -764,6 +764,25 @@ expectGlobalAndLocalErrors { global, local } reviewResult =
|
||||
()
|
||||
|
||||
|
||||
expectGlobalAndModuleErrors : { global : List { message : String, details : List String }, modules : List ( String, List ExpectedError ) } -> ReviewResult -> Expectation
|
||||
expectGlobalAndModuleErrors { global, modules } reviewResult =
|
||||
case reviewResult of
|
||||
FailedRun errorMessage ->
|
||||
Expect.fail errorMessage
|
||||
|
||||
SuccessfulRun globalErrors runResults ->
|
||||
Expect.all
|
||||
[ \() ->
|
||||
if List.isEmpty global then
|
||||
expectNoGlobalErrors globalErrors
|
||||
|
||||
else
|
||||
Expect.all (checkAllGlobalErrorsMatch { expected = global, actual = globalErrors }) ()
|
||||
, \() -> expectErrorsForModulesHelp modules runResults
|
||||
]
|
||||
()
|
||||
|
||||
|
||||
expectErrorsForModulesHelp : List ( String, List ExpectedError ) -> List SuccessfulRunResult -> Expectation
|
||||
expectErrorsForModulesHelp expectedErrorsList runResults =
|
||||
let
|
||||
|
Loading…
Reference in New Issue
Block a user