@@ -64,6 +64,10 @@ defmodule Phoenix.Sync.RouterTest do
6464 sync "/query-config" , Support.Todo , replica: :full
6565 sync "/query-config2" , Support.Todo , replica: :full , storage: % { compaction: :disabled }
6666 end
67+
68+ scope "/namespaced-sync" , WebNamespace do
69+ sync "/todos" , Support.Todo
70+ end
6771 end
6872
6973 defmodule Endpoint do
@@ -112,6 +116,30 @@ defmodule Phoenix.Sync.RouterTest do
112116 ] = Jason . decode! ( resp . resp_body )
113117 end
114118
119+ @ tag table: {
120+ "todos" ,
121+ [
122+ "id int8 not null primary key generated always as identity" ,
123+ "title text" ,
124+ "completed boolean default false"
125+ ]
126+ }
127+ @ tag data: { "todos" , [ "title" ] , [ [ "one" ] , [ "two" ] , [ "three" ] ] }
128+ test "supports schema modules within aliased scope" , _ctx do
129+ resp =
130+ Phoenix.ConnTest . build_conn ( )
131+ |> Phoenix.ConnTest . get ( "/namespaced-sync/todos" , % { offset: "-1" } )
132+
133+ assert resp . status == 200
134+ assert Plug.Conn . get_resp_header ( resp , "electric-offset" ) == [ "0_0" ]
135+
136+ assert [
137+ % { "headers" => % { "operation" => "insert" } , "value" => % { "title" => "one" } } ,
138+ % { "headers" => % { "operation" => "insert" } , "value" => % { "title" => "two" } } ,
139+ % { "headers" => % { "operation" => "insert" } , "value" => % { "title" => "three" } }
140+ ] = Jason . decode! ( resp . resp_body )
141+ end
142+
115143 @ tag table: {
116144 "todos" ,
117145 [
0 commit comments