test: add GridCache prune_older_than ETS test

Coverage: 79.07%
This commit is contained in:
Graham McIntire 2026-05-07 13:59:42 -05:00
parent 3a2a28437d
commit 6028e8a838
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -221,4 +221,18 @@ defmodule Microwaveprop.Weather.GridCacheTest do
assert {:ok, _} = GridCache.fetch(~U[2026-04-12 11:00:00Z]) assert {:ok, _} = GridCache.fetch(~U[2026-04-12 11:00:00Z])
end end
end end
describe "prune_older_than/1" do
test "removes expired valid_times" do
GridCache.put(~U[2026-04-12 10:00:00Z], [%{lat: 32.0, lon: -97.0}])
GridCache.put(~U[2026-04-12 11:00:00Z], [%{lat: 32.0, lon: -97.0}])
past = ~U[2026-04-12 10:30:00Z]
removed = GridCache.prune_older_than(past)
assert removed == 1
assert GridCache.fetch(~U[2026-04-12 10:00:00Z]) == :miss
assert {:ok, _} = GridCache.fetch(~U[2026-04-12 11:00:00Z])
end
end
end end