alertmanager/ui/app/tests/Helpers.elm
Max Leonard Inden 9ec25d84c5
test: Introduce elm-test package
Adding two basic (fuzz-) tests for Utils.Filter.parseMatcher. Including
tests in Travis runs. Adding make target "test" and "dev-server".
2017-04-25 12:03:02 +02:00

32 lines
696 B
Elm

module Helpers exposing (isNotEmptyTrimmedAlphabetWord)
import String
isNotEmptyTrimmedAlphabetWord : String -> Bool
isNotEmptyTrimmedAlphabetWord string =
let
stringLength =
String.length string
in
stringLength
/= 0
&& String.length (String.filter isLetter string)
== stringLength
isLetter : Char -> Bool
isLetter char =
String.contains (String.fromChar char) (lowerCaseAlphabet)
|| String.contains (String.fromChar char) (upperCaseAlphabet)
lowerCaseAlphabet : String
lowerCaseAlphabet =
"abcdefghijklmnopqrstuvwxyz"
upperCaseAlphabet : String
upperCaseAlphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"