mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Add fuzz test for folders
This commit is contained in:
parent
98f08aa62a
commit
f9f0f1b0b5
@ -33,6 +33,13 @@ type alias Summary =
|
||||
}
|
||||
|
||||
|
||||
toStrings : Summary -> { files : List { string : String, included : Bool }, excludedFolders : List String }
|
||||
toStrings summary =
|
||||
{ files = summary.strings
|
||||
, excludedFolders = summary.excludeFoldersStrings
|
||||
}
|
||||
|
||||
|
||||
type CompactFilePattern
|
||||
= CompactInclude (List Glob)
|
||||
| CompactExclude (List Glob)
|
||||
@ -48,13 +55,6 @@ compact filePatterns =
|
||||
}
|
||||
|
||||
|
||||
toStrings : Summary -> { files : List { string : String, included : Bool }, excludedFolders : List String }
|
||||
toStrings summary =
|
||||
{ files = List.reverse summary.strings
|
||||
, excludedFolders = summary.excludeFoldersStrings
|
||||
}
|
||||
|
||||
|
||||
compactBase : List FilePattern -> Summary -> Result (List String) Summary
|
||||
compactBase filePatterns accSummary =
|
||||
case filePatterns of
|
||||
@ -93,8 +93,8 @@ compactHelp filePatterns accGlobs included accSummary =
|
||||
)
|
||||
:: accSummary.includeExclude
|
||||
, excludeFolders = accSummary.excludeFolders
|
||||
, strings = accSummary.strings
|
||||
, excludeFoldersStrings = accSummary.excludeFoldersStrings
|
||||
, strings = List.reverse accSummary.strings
|
||||
, excludeFoldersStrings = List.reverse accSummary.excludeFoldersStrings
|
||||
}
|
||||
|
||||
(Include ( raw, pattern )) :: rest ->
|
||||
|
@ -2,7 +2,7 @@ module Review.FilePatternTest exposing (all)
|
||||
|
||||
import Expect
|
||||
import Fuzz
|
||||
import Review.FilePattern as FilePattern exposing (FilePattern, include)
|
||||
import Review.FilePattern as FilePattern exposing (FilePattern, excludeFolder, include)
|
||||
import Test exposing (Test, describe, fuzz, test)
|
||||
|
||||
|
||||
@ -120,6 +120,24 @@ toStringsTest =
|
||||
|> .files
|
||||
|> Expect.equal list
|
||||
|
||||
Err _ ->
|
||||
Expect.pass
|
||||
, fuzz
|
||||
(Fuzz.list Fuzz.string)
|
||||
"excluded folders should stay as before"
|
||||
<|
|
||||
\list ->
|
||||
case
|
||||
list
|
||||
|> List.map FilePattern.excludeFolder
|
||||
|> FilePattern.compact
|
||||
of
|
||||
Ok summary ->
|
||||
summary
|
||||
|> FilePattern.toStrings
|
||||
|> .excludedFolders
|
||||
|> Expect.equal list
|
||||
|
||||
Err _ ->
|
||||
Expect.pass
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user