module InputTable.RowFilterTest exposing (all) import Expect import Test exposing (Test, test, describe) import InputTable.RowFilter as RowFilter import InputTable.TestData exposing (..) all : Test all = describe "RowFilter.run" [ test "should filter rows that do not pass a text column filter" <| \() -> Expect.equal (RowFilter.run rows [ columnX "10", columnY Nothing ] "") ([ row1, row2 ]) , test "should filter rows that do not pass a bool column filter" <| \() -> Expect.equal (RowFilter.run rows [ columnX "", columnY (Just True) ] "") ([ row2, row3 ]) , test "should filter rows that do not pass a combination of text filters" <| \() -> Expect.equal (RowFilter.run rows [ columnX "1", columnZ "2" ] "") ([ row1 ]) , test "should filter rows that do not pass a combination of text and bool filters" <| \() -> Expect.equal (RowFilter.run rows [ columnX "2", columnY (Just False) ] "") ([ row4 ]) , test "should filter rows that do not pass the search text" <| \() -> Expect.equal (RowFilter.run rows [ columnX "", columnY Nothing, columnZ "" ] "1") ([ row1, row2, row3 ]) , test "should filter rows that do not pass a combination of column filter and search text" <| \() -> Expect.equal (RowFilter.run rows [ columnX "2", columnY (Just True), columnZ "" ] "1") ([ row3 ]) ]