github.com/simpleiot/simpleiot@v0.18.3/frontend/tests/Duration.elm (about)

     1  module Duration exposing (all)
     2  
     3  import Expect
     4  import Test exposing (..)
     5  import Utils.Duration as Duration
     6  
     7  
     8  all : Test
     9  all =
    10      describe "The Duration module"
    11          [ test "toString" <|
    12              \_ ->
    13                  Expect.equal (Duration.toString 1234123232) "14d 6h 48m 43s"
    14          , test "toString s only" <|
    15              \_ ->
    16                  Expect.equal (Duration.toString <| 45 * 1000) "45s"
    17          , test "toString 1s over a day" <|
    18              \_ ->
    19                  Expect.equal (Duration.toString <| 1000 * 60 * 60 * 24 + 1000) "1d 1s"
    20          ]