mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-11 12:17:22 +03:00
37 lines
1.2 KiB
Elm
37 lines
1.2 KiB
Elm
module PathTests exposing (all)
|
|
|
|
import Expect
|
|
import Path
|
|
import Test exposing (Test, describe, test)
|
|
|
|
|
|
all : Test
|
|
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"
|
|
, 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"
|
|
]
|