Update tests

Signed-off-by: Andrey Kuzmin <andrey.kuzmin@soundcloud.com>
This commit is contained in:
Andrey Kuzmin 2019-04-27 12:31:48 +02:00
parent 461a6e5450
commit eb8345e72f
1 changed files with 10 additions and 6 deletions

View File

@ -36,27 +36,31 @@ generateQueryString =
[ test "should default silenced & inhibited parameters to false if showSilenced is Nothing" <|
\() ->
Expect.equal "?silenced=false&inhibited=false"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Nothing, showSilenced = Nothing, showInhibited = Nothing })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Nothing, showSilenced = Nothing, showInhibited = Nothing })
, test "should not render keys with Nothing value except the silenced and inhibited parameters" <|
\() ->
Expect.equal "?silenced=false&inhibited=false"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Nothing, showSilenced = Nothing, showInhibited = Nothing })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Nothing, showSilenced = Nothing, showInhibited = Nothing })
, test "should not render filter key with empty value" <|
\() ->
Expect.equal "?silenced=false&inhibited=false"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Just "", showSilenced = Nothing, showInhibited = Nothing })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Just "", showSilenced = Nothing, showInhibited = Nothing })
, test "should render filter key with values" <|
\() ->
Expect.equal "?silenced=false&inhibited=false&filter=%7Bfoo%3D%22bar%22%2C%20baz%3D~%22quux.*%22%7D"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Just "{foo=\"bar\", baz=~\"quux.*\"}", showSilenced = Nothing, showInhibited = Nothing })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Just "{foo=\"bar\", baz=~\"quux.*\"}", showSilenced = Nothing, showInhibited = Nothing })
, test "should render silenced key with bool" <|
\() ->
Expect.equal "?silenced=true&inhibited=false"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Nothing, showSilenced = Just True, showInhibited = Nothing })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Nothing, showSilenced = Just True, showInhibited = Nothing })
, test "should render inhibited key with bool" <|
\() ->
Expect.equal "?silenced=false&inhibited=true"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, text = Nothing, showSilenced = Nothing, showInhibited = Just True })
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = False, text = Nothing, showSilenced = Nothing, showInhibited = Just True })
, test "should add customGrouping key" <|
\() ->
Expect.equal "?silenced=false&inhibited=false&customGrouping=true"
(Utils.Filter.generateQueryString { receiver = Nothing, group = Nothing, customGrouping = True, text = Nothing, showSilenced = Nothing, showInhibited = Nothing })
]