Last active
February 7, 2021 16:45
-
-
Save karlosmid/5682c8ac83bdcaea02c982a9a4dfd777 to your computer and use it in GitHub Desktop.
ExKeyCDN Zone test using Mox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExKeyCDN.ZoneTest do | |
use ExUnit.Case, async: true | |
import Mox | |
# Make sure mocks are verified when the test exits | |
setup :verify_on_exit! | |
describe "list/0" do | |
test "mock" do | |
expected = [ | |
zones: [%ExKeyCDN.Zone{}, %ExKeyCDN.Zone{}], | |
limits: [rate_limit_remaining: "60", rate_limit: "60"] | |
] | |
ExKeyCDN.MockZone | |
|> expect(:list, fn -> expected end) | |
assert zone().list() == expected | |
end | |
end | |
defp zone do | |
Application.get_env(:exkeycdn, :zone) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment