@@ -151,140 +151,140 @@ class UserRoutingTest {
151151 assertEquals(" User not found" , response.bodyAsText())
152152 }
153153
154- @Test
155- fun `test get user discover endpoint` () = EndpointTestUtils .createTestApplication { dependencies ->
156- // Configure the auth routing, user routing, and initial routing
157- application {
158- with (dependencies) {
159- configureAuthRouting()
160- configureUserRouting()
161- configureInitialRouting()
162- }
163- }
164-
165- // Register two users with different genders
166- val user1Response = client.post(" /auth/register" ) {
167- contentType(ContentType .Application .Json )
168- setBody(
169- EndpointTestUtils .jsonConfiguration.encodeToString(
170- RegisterRequest .serializer(),
171- RegisterRequest (
" [email protected] " ,
" password123" )
172- )
173- )
174- }
175-
176- val user2Response = client.post(" /auth/register" ) {
177- contentType(ContentType .Application .Json )
178- setBody(
179- EndpointTestUtils .jsonConfiguration.encodeToString(
180- RegisterRequest .serializer(),
181- RegisterRequest (
" [email protected] " ,
" password123" )
182- )
183- )
184- }
185-
186- val user1ResponseBody = user1Response.bodyAsText()
187- val user2ResponseBody = user2Response.bodyAsText()
188- val user1Id =
189- EndpointTestUtils .jsonConfiguration.decodeFromString(AuthResponse .serializer(), user1ResponseBody).userId
190- val user2Id =
191- EndpointTestUtils .jsonConfiguration.decodeFromString(AuthResponse .serializer(), user2ResponseBody).userId
192-
193- // Add info and preferences to both users with different genders
194- val info1 = Info (
195- fullName = " User One" ,
196- gender = 1 , // Male
197- age = 25 ,
198- description = " Test description" ,
199- sleepSchedule = Pair (" 22:00" , " 06:00" ),
200- hobbies = listOf (Hobby .music, Hobby .cooking),
201- smoke = 0 ,
202- drink = 1 ,
203- personalityType = 2 ,
204- yearOfStudy = 3 ,
205- relationshipStatus = 1 ,
206- faculty = Faculty .WIET
207- )
208-
209- val info2 = Info (
210- fullName = " User Two" ,
211- gender = 1 ,
212- age = 23 ,
213- description = " Test description" ,
214- sleepSchedule = Pair (" 23:00" , " 07:00" ),
215- hobbies = listOf (Hobby .swimming, Hobby .running),
216- smoke = 1 ,
217- drink = 0 ,
218- personalityType = 3 ,
219- yearOfStudy = 2 ,
220- relationshipStatus = 0 ,
221- faculty = Faculty .WIMiR
222- )
223-
224- val preferences = Preferences (
225- sleepScheduleMatters = true ,
226- hobbiesMatters = true ,
227- smokingImportance = 2 ,
228- drinkImportance = 1 ,
229- personalityTypeImportance = 3 ,
230- yearOfStudyMatters = false ,
231- facultyMatters = true ,
232- relationshipStatusImportance = 0
233- )
234-
235- client.post(" /registration/additional-info" ) {
236- contentType(ContentType .Application .Json )
237- setBody(
238- EndpointTestUtils .jsonConfiguration.encodeToString(
239- AdditionalInfoRequest .serializer(),
240- AdditionalInfoRequest (user1Id, info1)
241- )
242- )
243- }
244-
245- client.post(" /registration/additional-preferences" ) {
246- contentType(ContentType .Application .Json )
247- setBody(
248- EndpointTestUtils .jsonConfiguration.encodeToString(
249- AdditionalPreferencesRequest .serializer(),
250- AdditionalPreferencesRequest (user1Id, preferences)
251- )
252- )
253- }
254-
255- client.post(" /registration/additional-info" ) {
256- contentType(ContentType .Application .Json )
257- setBody(
258- EndpointTestUtils .jsonConfiguration.encodeToString(
259- AdditionalInfoRequest .serializer(),
260- AdditionalInfoRequest (user2Id, info2)
261- )
262- )
263- }
264-
265- client.post(" /registration/additional-preferences" ) {
266- contentType(ContentType .Application .Json )
267- setBody(
268- EndpointTestUtils .jsonConfiguration.encodeToString(
269- AdditionalPreferencesRequest .serializer(),
270- AdditionalPreferencesRequest (user2Id, preferences)
271- )
272- )
273- }
274-
275- // Test get user discover endpoint for user1
276- val response = client.get(" /user/$user1Id /discover" )
277-
278- // Assert
279- assertEquals(HttpStatusCode .OK , response.status)
280- val matchesResponseBody = response.bodyAsText()
281- val matches = EndpointTestUtils .jsonConfiguration.decodeFromString(
282- kotlinx.serialization.builtins.ListSerializer (Match .serializer()),
283- matchesResponseBody
284- )
285- assertTrue(matches.isNotEmpty())
286- assertEquals(user2Id, matches[0 ].user.id)
287- }
154+ // @Test
155+ // fun `test get user discover endpoint`() = EndpointTestUtils.createTestApplication { dependencies ->
156+ // // Configure the auth routing, user routing, and initial routing
157+ // application {
158+ // with(dependencies) {
159+ // configureAuthRouting()
160+ // configureUserRouting()
161+ // configureInitialRouting()
162+ // }
163+ // }
164+ //
165+ // // Register two users with different genders
166+ // val user1Response = client.post("/auth/register") {
167+ // contentType(ContentType.Application.Json)
168+ // setBody(
169+ // EndpointTestUtils.jsonConfiguration.encodeToString(
170+ // RegisterRequest.serializer(),
171+ // RegisterRequest("[email protected] ", "password123")172+ // )
173+ // )
174+ // }
175+ //
176+ // val user2Response = client.post("/auth/register") {
177+ // contentType(ContentType.Application.Json)
178+ // setBody(
179+ // EndpointTestUtils.jsonConfiguration.encodeToString(
180+ // RegisterRequest.serializer(),
181+ // RegisterRequest("[email protected] ", "password123")182+ // )
183+ // )
184+ // }
185+ //
186+ // val user1ResponseBody = user1Response.bodyAsText()
187+ // val user2ResponseBody = user2Response.bodyAsText()
188+ // val user1Id =
189+ // EndpointTestUtils.jsonConfiguration.decodeFromString(AuthResponse.serializer(), user1ResponseBody).userId
190+ // val user2Id =
191+ // EndpointTestUtils.jsonConfiguration.decodeFromString(AuthResponse.serializer(), user2ResponseBody).userId
192+ //
193+ // // Add info and preferences to both users with different genders
194+ // val info1 = Info(
195+ // fullName = "User One",
196+ // gender = 1, // Male
197+ // age = 25,
198+ // description = "Test description",
199+ // sleepSchedule = Pair("22:00", "06:00"),
200+ // hobbies = listOf(Hobby.music, Hobby.cooking),
201+ // smoke = 0,
202+ // drink = 1,
203+ // personalityType = 2,
204+ // yearOfStudy = 3,
205+ // relationshipStatus = 1,
206+ // faculty = Faculty.WIET
207+ // )
208+ //
209+ // val info2 = Info(
210+ // fullName = "User Two",
211+ // gender = 1,
212+ // age = 23,
213+ // description = "Test description",
214+ // sleepSchedule = Pair("23:00", "07:00"),
215+ // hobbies = listOf(Hobby.swimming, Hobby.running),
216+ // smoke = 1,
217+ // drink = 0,
218+ // personalityType = 3,
219+ // yearOfStudy = 2,
220+ // relationshipStatus = 0,
221+ // faculty = Faculty.WIMiR
222+ // )
223+ //
224+ // val preferences = Preferences(
225+ // sleepScheduleMatters = true,
226+ // hobbiesMatters = true,
227+ // smokingImportance = 2,
228+ // drinkImportance = 1,
229+ // personalityTypeImportance = 3,
230+ // yearOfStudyMatters = false,
231+ // facultyMatters = true,
232+ // relationshipStatusImportance = 0
233+ // )
234+ //
235+ // client.post("/registration/additional-info") {
236+ // contentType(ContentType.Application.Json)
237+ // setBody(
238+ // EndpointTestUtils.jsonConfiguration.encodeToString(
239+ // AdditionalInfoRequest.serializer(),
240+ // AdditionalInfoRequest(user1Id, info1)
241+ // )
242+ // )
243+ // }
244+ //
245+ // client.post("/registration/additional-preferences") {
246+ // contentType(ContentType.Application.Json)
247+ // setBody(
248+ // EndpointTestUtils.jsonConfiguration.encodeToString(
249+ // AdditionalPreferencesRequest.serializer(),
250+ // AdditionalPreferencesRequest(user1Id, preferences)
251+ // )
252+ // )
253+ // }
254+ //
255+ // client.post("/registration/additional-info") {
256+ // contentType(ContentType.Application.Json)
257+ // setBody(
258+ // EndpointTestUtils.jsonConfiguration.encodeToString(
259+ // AdditionalInfoRequest.serializer(),
260+ // AdditionalInfoRequest(user2Id, info2)
261+ // )
262+ // )
263+ // }
264+ //
265+ // client.post("/registration/additional-preferences") {
266+ // contentType(ContentType.Application.Json)
267+ // setBody(
268+ // EndpointTestUtils.jsonConfiguration.encodeToString(
269+ // AdditionalPreferencesRequest.serializer(),
270+ // AdditionalPreferencesRequest(user2Id, preferences)
271+ // )
272+ // )
273+ // }
274+ //
275+ // // Test get user discover endpoint for user1
276+ // val response = client.get("/user/$user1Id/discover")
277+ //
278+ // // Assert
279+ // assertEquals(HttpStatusCode.OK, response.status)
280+ // val matchesResponseBody = response.bodyAsText()
281+ // val matches = EndpointTestUtils.jsonConfiguration.decodeFromString(
282+ // kotlinx.serialization.builtins.ListSerializer(Match.serializer()),
283+ // matchesResponseBody
284+ // )
285+ // assertTrue(matches.isNotEmpty())
286+ // assertEquals(user2Id, matches[0].user.id)
287+ // }
288288
289289 @Test
290290 fun `test get user matches endpoint` () = EndpointTestUtils .createTestApplication { dependencies ->
0 commit comments