pull/2182/head
Ayrat Badykov 6 years ago
parent 9156f2d2e9
commit b6a27897a2
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 4
      apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs
  2. 3
      apps/block_scout_web/test/support/channel_case.ex
  3. 7
      apps/explorer/test/explorer/market/market_test.exs

@ -43,6 +43,8 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do
describe "new_rate" do describe "new_rate" do
test "subscribed user is notified", %{token: token} do test "subscribed user is notified", %{token: token} do
ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) ExchangeRates.handle_info({nil, {:ok, [token]}}, %{})
Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
topic = "exchange_rate:new_rate" topic = "exchange_rate:new_rate"
@endpoint.subscribe(topic) @endpoint.subscribe(topic)
@ -61,6 +63,8 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do
test "subscribed user is notified with market history", %{token: token} do test "subscribed user is notified with market history", %{token: token} do
ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) ExchangeRates.handle_info({nil, {:ok, [token]}}, %{})
Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
today = Date.utc_today() today = Date.utc_today()

@ -31,9 +31,6 @@ defmodule BlockScoutWeb.ChannelCase do
setup tags do setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo)
Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()})
unless tags[:async] do unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()}) Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()})
end end

@ -5,6 +5,13 @@ defmodule Explorer.MarketTest do
alias Explorer.Market.MarketHistory alias Explorer.Market.MarketHistory
alias Explorer.Repo alias Explorer.Repo
setup do
Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Chain.BlocksCache.cache_name()})
Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Chain.BlocksCache.cache_name()})
:ok
end
test "fetch_recent_history/1" do test "fetch_recent_history/1" do
today = Date.utc_today() today = Date.utc_today()

Loading…
Cancel
Save