elm-pages-v3-beta/tests/PathTests.elm

37 lines
1.2 KiB
Elm
Raw Normal View History

2021-05-23 20:03:21 +03:00
module PathTests exposing (all)
import Expect
import Path
2021-06-04 03:59:58 +03:00
import Test exposing (Test, describe, test)
2021-05-23 20:03:21 +03:00
2021-06-04 03:59:58 +03:00
all : Test
2021-05-23 20:03:21 +03:00
all =
describe "Path"
[ test "join two segments" <|
\() ->
Path.join [ "a", "b", "c" ]
|> Path.toAbsolute
|> Expect.equal "/a/b/c"
, test "join segments that have paths in them" <|
\() ->
Path.join [ "a", "b", "c/d/e" ]
|> Path.toAbsolute
|> Expect.equal "/a/b/c/d/e"
, test "removes trailing and leading slashes" <|
\() ->
Path.join [ "a/", "/b/", "/c/d/e/" ]
|> Path.toAbsolute
|> Expect.equal "/a/b/c/d/e"
2021-05-23 20:07:39 +03:00
, test "fromString with trailing and leading" <|
\() ->
Path.fromString "/blog/post-1/"
|> Path.toAbsolute
|> Expect.equal "/blog/post-1"
, test "fromString without trailing and leading" <|
\() ->
Path.fromString "blog/post-1"
|> Path.toAbsolute
|> Expect.equal "/blog/post-1"
2021-05-23 20:03:21 +03:00
]