-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use correct column name from the control plane (#1970)
- Loading branch information
1 parent
ffd7e13
commit 501e119
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/sync-service/test/electric/control_plane_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
defmodule Electric.ControlPlaneTest do | ||
alias Electric.ControlPlane | ||
use ExUnit.Case, async: true | ||
|
||
setup ctx do | ||
%{ | ||
plane: %ControlPlane{ | ||
base_url: "http://localhost", | ||
req_opts: [ | ||
plug: fn conn -> | ||
conn | ||
|> Plug.Conn.put_resp_content_type("application/json") | ||
|> Plug.Conn.put_resp_header("electric-up-to-date", "true") | ||
|> Plug.Conn.send_resp(200, Jason.encode!(ctx.plug_response)) | ||
end | ||
] | ||
} | ||
} | ||
end | ||
|
||
describe "list_tenants/2" do | ||
@tag plug_response: [ | ||
%{ | ||
headers: %{operation: "insert"}, | ||
key: "id1", | ||
value: %{ | ||
id: "test_id", | ||
connection_url: "postgresql://test:me@localhost:5432/postgres" | ||
} | ||
} | ||
] | ||
test "returns tenants from an Electric API", %{plane: plane} do | ||
assert {:ok, | ||
[ | ||
%{ | ||
"connection_url" => "postgresql://test:me@localhost:5432/postgres", | ||
"id" => "test_id" | ||
} | ||
], | ||
[]} = ControlPlane.list_tenants(plane, app_config: %{electric_instance_id: "test"}) | ||
end | ||
end | ||
end |