Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Aug 28, 2024
1 parent 5daf2ee commit 6a645d4
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/plausible/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,23 @@ defmodule Plausible.ConfigTest do
end

describe "storage" do
test "defaults" do
env = [
{"MAXMIND_LICENSE_KEY", "abc"},
{"PERSISTENT_CACHE_DIR", nil},
{"DATA_DIR", nil}
]

config = runtime_config(env)

# exports/imports
assert get_in(config, [:plausible, :data_dir]) == "/var/lib/plausible"
# locus (mmdb cache)
assert get_in(config, [:plausible, Plausible.Geo, :cache_dir]) == "/var/lib/plausible"
# tzdata (timezones cache)
assert get_in(config, [:tzdata, :data_dir]) == "/var/lib/plausible/tzdata_data"
end

test "with only DATA_DIR set" do
env = [
{"MAXMIND_LICENSE_KEY", "abc"},
Expand Down Expand Up @@ -322,7 +339,7 @@ defmodule Plausible.ConfigTest do
config = runtime_config(env)

# exports/imports
assert get_in(config, [:plausible, :data_dir]) == "/cache"
assert get_in(config, [:plausible, :data_dir]) == "/var/lib/plausible"
# locus (mmdb cache)
assert get_in(config, [:plausible, Plausible.Geo, :cache_dir]) == "/cache"
# tzdata (timezones cache)
Expand Down

0 comments on commit 6a645d4

Please sign in to comment.