Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AccessPointsAdapterGroup(
) {
if (!groupBy.none) {
wiFiDetails.getOrNull(groupPosition)?.let {
if (it.noChildren) {
if (it.hasChildren) {
expanded.remove(groupBy.group(it))
}
}
Expand All @@ -65,7 +65,7 @@ class AccessPointsAdapterGroup(
) {
if (!groupBy.none) {
wiFiDetails.getOrNull(groupPosition)?.let {
if (it.noChildren) {
if (it.hasChildren) {
expanded.add(groupBy.group(it))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data class WiFiDetail(
children,
)

val noChildren: Boolean get() = children.isNotEmpty()
val hasChildren: Boolean get() = children.isNotEmpty()

override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,28 +247,28 @@ class AccessPointsAdapterGroupTest {
// setup
doReturn(GroupBy.SSID).whenever(settings).groupBy()
fixture.updateGroupBy()
doReturn(false).whenever(wiFiDetailWithChildren).noChildren
doReturn(false).whenever(wiFiDetailWithChildren).hasChildren
val wiFiDetails = listOf(wiFiDetailWithChildren)
fixture.expanded.add("test")
// execute
fixture.onGroupCollapsed(wiFiDetails, 0)
// validate
assertThat(fixture.expanded).contains("test")
verify(wiFiDetailWithChildren).noChildren
verify(wiFiDetailWithChildren).hasChildren
}

@Test
fun onGroupExpandedDoesNotAddIfHasChildren() {
// setup
doReturn(GroupBy.SSID).whenever(settings).groupBy()
fixture.updateGroupBy()
doReturn(false).whenever(wiFiDetailWithChildren).noChildren
doReturn(false).whenever(wiFiDetailWithChildren).hasChildren
val wiFiDetails = listOf(wiFiDetailWithChildren)
// execute
fixture.onGroupExpanded(wiFiDetails, 0)
// validate
assertThat(fixture.expanded).isEmpty()
verify(wiFiDetailWithChildren).noChildren
verify(wiFiDetailWithChildren).hasChildren
Comment on lines 260 to +271
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name says "DoesNotAddIfHasChildren", but it stubs hasChildren to false and expects no change. Update the test name to reflect the hasChildren == false scenario, or adjust the setup/expectation so the name and behavior align.

Copilot uses AI. Check for mistakes.
}

private fun withWiFiDetail(): WiFiDetail =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ class WiFiDetailTest {
}

@Test
fun noChildrenReturnsFalseWhenChildrenIsEmpty() {
fun hasChildrenReturnsFalseWhenChildrenIsEmpty() {
val detail = WiFiDetail(wiFiIdentifier, wiFiSecurity, wiFiSignal, wiFiAdditional, listOf())
assertThat(detail.noChildren).isFalse()
assertThat(detail.hasChildren).isFalse()
}

@Test
fun noChildrenReturnsTrueWhenChildrenIsNotEmpty() {
fun hasChildrenReturnsTrueWhenChildrenIsNotEmpty() {
val child = WiFiDetail(WiFiIdentifier("childSSID", "childBSSID"), wiFiSecurity, wiFiSignal, wiFiAdditional)
val detail = WiFiDetail(wiFiIdentifier, wiFiSecurity, wiFiSignal, wiFiAdditional, listOf(child))
assertThat(detail.noChildren).isTrue()
assertThat(detail.hasChildren).isTrue()
}
}
Loading