elm-pass/tests/GitlabTests.elm
2018-01-17 17:22:39 -05:00

33 lines
1.1 KiB
Elm

module GitlabTests exposing (..)
import Expect
import Http
import Gitlab
import Test exposing (..)
suite : Test
suite =
let
clientWithoutToken =
Gitlab.Client "http://example.org" Nothing
clientWithToken =
Gitlab.Client "http://example.org" (Just "token")
in
describe "Gitlab"
[ test "Builds v4 API url" <|
\() ->
Expect.equal "http://example.org/api/v4/foo/bar" <|
Gitlab.apiUrl clientWithToken [ "foo", "bar" ]
, test "Includes private token in headers when available" <|
\() ->
Expect.true "Expected token header." <|
List.member (Http.header "Private-Token" "token") <|
Gitlab.apiHeaders clientWithToken
, test "Omits private token in headers when not available" <|
\() ->
Expect.false "Did not expect token header." <|
List.member (Http.header "Private-Token" "token") <|
Gitlab.apiHeaders clientWithoutToken
]