From d1e527ab3ac180bea3cf90ec3a66e5630266bba0 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 26 Apr 2024 17:51:47 +0300 Subject: [PATCH] Adds test for the isAchievement method --- .../android/models/NoteExtensionsTest.kt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 WordPress/src/test/java/org/wordpress/android/models/NoteExtensionsTest.kt diff --git a/WordPress/src/test/java/org/wordpress/android/models/NoteExtensionsTest.kt b/WordPress/src/test/java/org/wordpress/android/models/NoteExtensionsTest.kt new file mode 100644 index 000000000000..3a50bb42583c --- /dev/null +++ b/WordPress/src/test/java/org/wordpress/android/models/NoteExtensionsTest.kt @@ -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() + 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() + whenever(note.rawType).thenReturn("user_goal_met") + val result = note.isAchievement() + assertTrue(result) + } +}