-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20715 from wordpress-mobile/task/23-milestone-bas…
…ic-1 [Notifications Refresh] 🤖 Milestone Details: hides the title for achievements
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
WordPress/src/test/java/org/wordpress/android/models/AchievementTypeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.wordpress.android.models | ||
|
||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import org.junit.Test | ||
import org.wordpress.android.BaseUnitTest | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
|
||
@ExperimentalCoroutinesApi | ||
class AchievementTypeTest : BaseUnitTest() { | ||
@Test | ||
fun `isAchievementType returns true for valid achievement types`() { | ||
for (type in AchievementType.entries) { | ||
assertTrue(AchievementType.isAchievementType(type.rawType)) | ||
} | ||
} | ||
|
||
@Test | ||
fun `isAchievementType returns false for invalid achievement type`() { | ||
assertFalse(AchievementType.isAchievementType("invalid_type")) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
WordPress/src/test/java/org/wordpress/android/models/NoteExtensionsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.wordpress.android.models | ||
|
||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import org.junit.Test | ||
import org.mockito.kotlin.mock | ||
import org.mockito.kotlin.whenever | ||
import org.wordpress.android.BaseUnitTest | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
|
||
@ExperimentalCoroutinesApi | ||
class NoteExtensionsTest : BaseUnitTest() { | ||
@Test | ||
fun `A comment_like note is not an achievement note`(){ | ||
val note = mock<Note>() | ||
whenever(note.rawType).thenReturn("comment_like") | ||
val result = note.isAchievement() | ||
assertFalse(result) | ||
} | ||
|
||
@Test | ||
fun `A user_goal_met note is an achievement note`(){ | ||
val note = mock<Note>() | ||
whenever(note.rawType).thenReturn("user_goal_met") | ||
val result = note.isAchievement() | ||
assertTrue(result) | ||
} | ||
} |