@@ -34,12 +34,13 @@ mod tests {
3434 let server = MockServer :: start ( ) ;
3535
3636 // Create a mock on the server that can be called multiple times
37- server. mock_async ( |when, then| {
38- when. method ( GET ) . path ( "/quotes/stats.json" ) ;
39- then. status ( 200 )
40- . header ( "content-type" , "application/json" )
41- . body (
42- r#"
37+ server
38+ . mock_async ( |when, then| {
39+ when. method ( GET ) . path ( "/quotes/stats.json" ) ;
40+ then. status ( 200 )
41+ . header ( "content-type" , "application/json" )
42+ . body (
43+ r#"
4344 {
4445 "total": 3,
4546 "all": "https://fullStackbulletin.github.io/tech-quotes/quotes/all.json",
@@ -48,15 +49,18 @@ mod tests {
4849 "urlPrefix": "https://fullStackbulletin.github.io/tech-quotes/quotes"
4950 }
5051 "# ,
51- ) ;
52- } ) . await ;
52+ ) ;
53+ } )
54+ . await ;
5355
5456 // Mock all possible quote IDs (0, 1, 2) since we're using a small total
55- server. mock_async ( |when, then| {
56- when. method ( GET ) . path ( "/quotes/0.json" ) ;
57- then. status ( 200 )
58- . header ( "content-type" , "application/json" )
59- . body ( r#"
57+ server
58+ . mock_async ( |when, then| {
59+ when. method ( GET ) . path ( "/quotes/0.json" ) ;
60+ then. status ( 200 )
61+ . header ( "content-type" , "application/json" )
62+ . body (
63+ r#"
6064 {
6165 "id": 0,
6266 "text": "Test quote 0",
@@ -69,14 +73,18 @@ mod tests {
6973 },
7074 "url": "https://fullStackbulletin.github.io/tech-quotes/quotes/0.json"
7175 }
72- "# ) ;
73- } ) . await ;
76+ "# ,
77+ ) ;
78+ } )
79+ . await ;
7480
75- server. mock_async ( |when, then| {
76- when. method ( GET ) . path ( "/quotes/1.json" ) ;
77- then. status ( 200 )
78- . header ( "content-type" , "application/json" )
79- . body ( r#"
81+ server
82+ . mock_async ( |when, then| {
83+ when. method ( GET ) . path ( "/quotes/1.json" ) ;
84+ then. status ( 200 )
85+ . header ( "content-type" , "application/json" )
86+ . body (
87+ r#"
8088 {
8189 "id": 1,
8290 "text": "Test quote 1",
@@ -88,14 +96,18 @@ mod tests {
8896 },
8997 "url": "https://fullStackbulletin.github.io/tech-quotes/quotes/1.json"
9098 }
91- "# ) ;
92- } ) . await ;
99+ "# ,
100+ ) ;
101+ } )
102+ . await ;
93103
94- server. mock_async ( |when, then| {
95- when. method ( GET ) . path ( "/quotes/2.json" ) ;
96- then. status ( 200 )
97- . header ( "content-type" , "application/json" )
98- . body ( r#"
104+ server
105+ . mock_async ( |when, then| {
106+ when. method ( GET ) . path ( "/quotes/2.json" ) ;
107+ then. status ( 200 )
108+ . header ( "content-type" , "application/json" )
109+ . body (
110+ r#"
99111 {
100112 "id": 2,
101113 "text": "Test quote 2",
@@ -108,13 +120,19 @@ mod tests {
108120 },
109121 "url": "https://fullStackbulletin.github.io/tech-quotes/quotes/2.json"
110122 }
111- "# ) ;
112- } ) . await ;
123+ "# ,
124+ ) ;
125+ } )
126+ . await ;
113127
114128 // Test that the function successfully fetches a random quote
115129 let response = fetch_quote ( & server. base_url ( ) , 0 ) . await ;
116130
117- assert ! ( response. is_ok( ) , "Failed to fetch quote: {:?}" , response. err( ) ) ;
131+ assert ! (
132+ response. is_ok( ) ,
133+ "Failed to fetch quote: {:?}" ,
134+ response. err( )
135+ ) ;
118136
119137 let quote = response. unwrap ( ) ;
120138 // Verify the quote ID is in the valid range
0 commit comments