Skip to content

Commit

Permalink
Adds test for the isAchievement method
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Apr 26, 2024
1 parent 49035a2 commit d1e527a
Showing 1 changed file with 28 additions and 0 deletions.
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)
}
}

0 comments on commit d1e527a

Please sign in to comment.