-
Notifications
You must be signed in to change notification settings - Fork 0
/
chunkTest.elm
41 lines (34 loc) · 1.07 KB
/
chunkTest.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
port module Main exposing (..)
import Test.Runner.Node exposing (run)
import Json.Encode exposing (Value)
import Test exposing (..)
import Expect
import Chunk exposing (..)
tests : Test
tests =
describe "Chunk"
[ test "even chunks" <|
\() ->
Expect.equal [ [ 'a', 'b' ], [ 'c', 'd' ] ]
(chunk 2 [ 'a', 'b', 'c', 'd' ])
, test "uneven chunks" <|
\() ->
Expect.equal [ [ 'a', 'b', 'c' ], [ 'd' ] ]
(chunk 3 [ 'a', 'b', 'c', 'd' ])
, test "single items" <|
\() ->
Expect.equal [ [ 'a' ], [ 'b' ], [ 'c' ] ]
(chunk 1 [ 'a', 'b', 'c' ])
, test "single chunk" <|
\() ->
Expect.equal [ [ 'a' ] ]
(chunk 100 [ 'a' ])
, test "zero chunk size" <|
\() ->
Expect.equal []
(chunk 0 [ 'a', 'b', 'c' ])
]
main : Test.Runner.Node.TestProgram
main =
run emit tests
port emit : ( String, Value ) -> Cmd msg