Skip to content

Commit

Permalink
Add test to verify that poll is not reset when status is edited
Browse files Browse the repository at this point in the history
  • Loading branch information
André Gasser committed Mar 20, 2023
1 parent f81f19f commit 3aa0e85
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,34 @@ class V410StatusMethodsIntegrationTest {
assertEquals("Das ist der Spoilertext", editedStatus.spoilerText)
assertEquals("de", editedStatus.language)
}

@Test
fun `should not reset poll if status is edited`() {
// given
val user1Client = TestHelpers.getTrustAllClient(user1UserToken.accessToken)
val statusId = user1Client.statuses.postPoll(
status = "Do you think this test will pass?",
pollOptions = listOf("Yes", "No"),
pollExpiresIn = 300
).execute().id

// when
val editedPoll = user1Client.statuses.editStatus(
statusId = statusId,
status = "Do you really think this test will pass?",
).execute()

val editedPoll2 = user1Client.statuses.getStatus(statusId).execute()

// then
assertEquals("<p>Do you really think this test will pass?</p>", editedPoll2.content)
assertIterableEquals(listOf("Yes", "No"), editedPoll2.poll!!.options.stream().map { it.title }.collect(Collectors.toList()))
assertEquals(Status.Visibility.Public.value, editedPoll2.visibility)
assertEquals(0, editedPoll2.mediaAttachments.size)
assertFalse(editedPoll2.isSensitive)
assertEquals("", editedPoll2.spoilerText)
assertEquals("en", editedPoll2.language)
}
}

@Nested
Expand Down

0 comments on commit 3aa0e85

Please sign in to comment.