Refactor Nearby Location Tests to Improve Assertion Logic (#6103)

-Refactored testSearchCloseToCurrentLocationWhenFar: Simplified assertion by using assertFalse(!isClose) for better readability and logical clarity.

-Added testSearchCloseToCurrentLocationWhenClose: Created a new test case to validate behavior when the search is close to the current location, ensuring assertTrue(isClose) for correctness.

-Improved Coverage: These changes enhance the test coverage and reliability of the searchCloseToCurrentLocation function.
This commit is contained in:
Akshay Komar 2025-01-05 13:51:17 +05:30 committed by GitHub
parent 038ae9acd4
commit 25e467b3a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -306,7 +306,7 @@ class NearbyParentFragmentPresenterTest {
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
NearbyController.currentLocationSearchRadius = 148306.0
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
assertFalse(isClose!!.equals(false))
assertFalse(!isClose)
}
/**
@ -318,7 +318,7 @@ class NearbyParentFragmentPresenterTest {
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
NearbyController.currentLocationSearchRadius = 148307.0
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
assertTrue(isClose!!)
assertTrue(isClose)
}
fun expectMapAndListUpdate() {