Skip to content

Commit a339105

Browse files
author
Thomas Horta
committed
Get code coverage in unit tests to 100% in changed class
1 parent 9339c89 commit a339105

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

WordPress/src/test/java/org/wordpress/android/ui/bloggingprompts/BloggingPromptsPostTagProviderTest.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BloggingPromptsPostTagProviderTest : BaseUnitTest() {
4141
}
4242

4343
@Test
44-
fun `Should return the expected ReaderTag when promptIdSearchReaderTag is called`() {
44+
fun `Should return the expected ReaderTag when promptSearchReaderTag is called`() {
4545
whenever(readerUtilsWrapper.getTagFromTagUrl(any())).thenReturn(BLOGGING_PROMPT_ID_TAG)
4646
val expected = ReaderTag(
4747
BLOGGING_PROMPT_ID_TAG,
@@ -54,7 +54,22 @@ class BloggingPromptsPostTagProviderTest : BaseUnitTest() {
5454
assertEquals(expected, actual)
5555
}
5656

57+
@Test
58+
fun `Should return the base Prompt ReaderTag when promptSearchReaderTag is called`() {
59+
whenever(readerUtilsWrapper.getTagFromTagUrl(any())).thenReturn("")
60+
val expected = ReaderTag(
61+
BLOGGING_PROMPT_TAG,
62+
BLOGGING_PROMPT_TAG,
63+
BLOGGING_PROMPT_TAG,
64+
ReaderPostLogic.formatFullEndpointForTag(BLOGGING_PROMPT_TAG),
65+
ReaderTagType.FOLLOWED,
66+
)
67+
val actual = tagProvider.promptSearchReaderTag("invalid-url")
68+
assertEquals(expected, actual)
69+
}
70+
5771
companion object {
5872
private const val BLOGGING_PROMPT_ID_TAG = "dailyprompt-1234"
73+
private const val BLOGGING_PROMPT_TAG = "dailyprompt"
5974
}
6075
}

0 commit comments

Comments
 (0)