Skip to content

Commit

Permalink
Deduplicate setup_with_mocks() calls in WsServerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
alco committed Apr 23, 2024
1 parent 4170143 commit 4169713
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions components/electric/test/electric/satellite/ws_server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ defmodule Electric.Satellite.WebsocketServerTest do

import Mock

setup_with_mocks([
{Electric.Postgres.Repo, [:passthrough],
checkout: fn fun -> fun.() end,
transaction: fn fun -> fun.() end,
checked_out?: fn -> true end,
query: fn _, _ -> {:ok, %Postgrex.Result{columns: nil, rows: []}} end,
query!: fn _, _ -> %Postgrex.Result{columns: nil, rows: []} end}
]) do
%{}
end

setup ctx do
ctx =
ctx
Expand Down Expand Up @@ -75,6 +64,12 @@ defmodule Electric.Satellite.WebsocketServerTest do
end

setup_with_mocks([
{Electric.Postgres.Repo, [:passthrough],
checkout: fn fun -> fun.() end,
transaction: fn fun -> fun.() end,
checked_out?: fn -> true end,
query: fn _, _ -> {:ok, %Postgrex.Result{columns: nil, rows: []}} end,
query!: fn _, _ -> %Postgrex.Result{columns: nil, rows: []} end},
{Electric.Satellite.ClientReconnectionInfo, [:passthrough],
restore_cache_for_client: fn _, _ -> :ok end},
{SatelliteConnector, [:passthrough],
Expand Down

0 comments on commit 4169713

Please sign in to comment.