Skip to content

Commit

Permalink
Add test for NebulexRedisAdapter.stats/1
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncocking committed May 19, 2021
1 parent 27e8e24 commit 515d9cf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/nebulex_redis_adapter/stats_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule NebulexRedisAdapter.StatsTest do
use ExUnit.Case, async: true

alias Nebulex.Adapter.Stats, as: AdapterStats
alias Nebulex.Stats

setup do
%{stats_counter: AdapterStats.init(stats: true), now: DateTime.utc_now()}
end

describe "NebulexRedisAdapter.stats/1" do
test "returns valid %Stats{}", %{
stats_counter: stats_counter,
now: now
} do
assert %Stats{} =
stats = NebulexRedisAdapter.stats(%{stats_counter: stats_counter, started_at: now}),
"A %Stats{} struct is returned"

assert stats.metadata.started_at == now, "Medadata is correctly populated"
end
end
end

0 comments on commit 515d9cf

Please sign in to comment.