forked from aws-beam/aws-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.exs
More file actions
32 lines (26 loc) · 1.03 KB
/
Copy pathutil_test.exs
File metadata and controls
32 lines (26 loc) · 1.03 KB
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
defmodule AWS.CodeGen.UtilTest do
use ExUnit.Case, async: true
doctest AWS.CodeGen.Util
alias AWS.CodeGen.Util
describe "endpoint_url_env_var/1" do
test "derives the env var from a single-word sdkId" do
service = build_service("DynamoDB")
assert Util.endpoint_url_env_var(service) == "AWS_ENDPOINT_URL_DYNAMODB"
end
test "replaces interior spaces with underscores and uppercases the result" do
service = build_service("Elastic Beanstalk")
assert Util.endpoint_url_env_var(service) == "AWS_ENDPOINT_URL_ELASTIC_BEANSTALK"
end
test "handles multi-word sdkIds" do
service = build_service("CloudTrail Data")
assert Util.endpoint_url_env_var(service) == "AWS_ENDPOINT_URL_CLOUDTRAIL_DATA"
end
test "returns nil when the sdkId is missing" do
assert Util.endpoint_url_env_var(%{"traits" => %{}}) == nil
assert Util.endpoint_url_env_var(%{}) == nil
end
end
defp build_service(sdk_id) do
%{"traits" => %{"aws.api#service" => %{"sdkId" => sdk_id}}}
end
end