44
55from idom_router import (
66 Route ,
7- RoutesConstructor ,
8- configure ,
7+ RouterConstructor ,
8+ create_router ,
99 link ,
1010 use_location ,
1111 use_params ,
1414
1515
1616@pytest .fixture
17- def routes (backend : BackendFixture ):
18- return configure (backend .implementation )
17+ def router (backend : BackendFixture ):
18+ return create_router (backend .implementation )
1919
2020
21- def test_configure (backend ):
22- configure (backend .implementation )
23- configure (backend .implementation .use_location )
21+ def test_create_router (backend ):
22+ create_router (backend .implementation )
23+ create_router (backend .implementation .use_location )
2424 with pytest .raises (
2525 TypeError , match = "Expected a 'BackendImplementation' or 'use_location' hook"
2626 ):
27- configure (None )
27+ create_router (None )
2828
2929
30- async def test_simple_router (display : DisplayFixture , routes : RoutesConstructor ):
30+ async def test_simple_router (display : DisplayFixture , router : RouterConstructor ):
3131 def make_location_check (path , * routes ):
3232 name = path .lstrip ("/" ).replace ("/" , "-" )
3333
@@ -40,7 +40,7 @@ def check_location():
4040
4141 @component
4242 def sample ():
43- return routes (
43+ return router (
4444 make_location_check ("/a" ),
4545 make_location_check ("/b" ),
4646 make_location_check ("/c" ),
@@ -68,10 +68,10 @@ def sample():
6868 assert not await root_element .inner_html ()
6969
7070
71- async def test_nested_routes (display : DisplayFixture , routes : RoutesConstructor ):
71+ async def test_nested_routes (display : DisplayFixture , router : RouterConstructor ):
7272 @component
7373 def sample ():
74- return routes (
74+ return router (
7575 Route (
7676 "/a" ,
7777 html .h1 ({"id" : "a" }, "A" ),
@@ -94,13 +94,13 @@ def sample():
9494 await display .page .wait_for_selector (selector )
9595
9696
97- async def test_navigate_with_link (display : DisplayFixture , routes : RoutesConstructor ):
97+ async def test_navigate_with_link (display : DisplayFixture , router : RouterConstructor ):
9898 render_count = Ref (0 )
9999
100100 @component
101101 def sample ():
102102 render_count .current += 1
103- return routes (
103+ return router (
104104 Route ("/" , link ({"id" : "root" }, "Root" , to = "/a" )),
105105 Route ("/a" , link ({"id" : "a" }, "A" , to = "/b" )),
106106 Route ("/b" , link ({"id" : "b" }, "B" , to = "/c" )),
@@ -121,7 +121,7 @@ def sample():
121121 assert render_count .current == 1
122122
123123
124- async def test_use_params (display : DisplayFixture , routes : RoutesConstructor ):
124+ async def test_use_params (display : DisplayFixture , router : RouterConstructor ):
125125 expected_params = {}
126126
127127 @component
@@ -131,7 +131,7 @@ def check_params():
131131
132132 @component
133133 def sample ():
134- return routes (
134+ return router (
135135 Route (
136136 "/first/{first:str}" ,
137137 check_params (),
@@ -157,7 +157,7 @@ def sample():
157157 await display .page .wait_for_selector ("#success" )
158158
159159
160- async def test_use_query (display : DisplayFixture , routes : RoutesConstructor ):
160+ async def test_use_query (display : DisplayFixture , router : RouterConstructor ):
161161 expected_query = {}
162162
163163 @component
@@ -167,7 +167,7 @@ def check_query():
167167
168168 @component
169169 def sample ():
170- return routes (Route ("/" , check_query ()))
170+ return router (Route ("/" , check_query ()))
171171
172172 await display .show (sample )
173173
0 commit comments