File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
features/messages/impl/src
main/kotlin/io/element/android/features/messages/impl/actionlist/model
test/kotlin/io/element/android/features/messages/impl/actionlist/model Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 77
88package io.element.android.features.messages.impl.actionlist.model
99
10+ import androidx.annotation.VisibleForTesting
11+
1012class TimelineItemActionComparator : Comparator <TimelineItemAction > {
1113 // See order in https://www.figma.com/design/ux3tYoZV9WghC7hHT9Fhk0/Compound-iOS-Components?node-id=2946-2392
12- private val orderedList = listOf (
14+ @VisibleForTesting
15+ val orderedList = listOf (
1316 TimelineItemAction .EndPoll ,
1417 TimelineItemAction .ViewInTimeline ,
1518 TimelineItemAction .Reply ,
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2024 New Vector Ltd.
3+ *
4+ * SPDX-License-Identifier: AGPL-3.0-only
5+ * Please see LICENSE in the repository root for full details.
6+ */
7+
8+ package io.element.android.features.messages.impl.actionlist.model
9+
10+ import org.junit.Test
11+
12+ class TimelineItemActionComparatorTest {
13+ @Test
14+ fun `check that the list in the comparator only contain each item once` () {
15+ val sut = TimelineItemActionComparator ()
16+ sut.orderedList.forEach {
17+ require(sut.orderedList.count { item -> item == it } == 1 , { " Duplicate ${it::class .java} .$it " })
18+ }
19+ }
20+
21+ @Test
22+ fun `check that the list in the comparator contains all the items` () {
23+ val sut = TimelineItemActionComparator ()
24+ TimelineItemAction .entries.forEach {
25+ require(it in sut.orderedList, { " Missing ${it::class .simpleName} .$it in orderedList" })
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments