test: add GridCache prune_older_than ETS test
Coverage: 79.07%
This commit is contained in:
parent
3a2a28437d
commit
6028e8a838
1 changed files with 14 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue