diff --git a/app/src/test/kotlin/com/wespot/notification/service/InquiryNotificationServiceTest.kt b/app/src/test/kotlin/com/wespot/notification/service/InquiryNotificationServiceTest.kt index 808d8a46..5de39340 100644 --- a/app/src/test/kotlin/com/wespot/notification/service/InquiryNotificationServiceTest.kt +++ b/app/src/test/kotlin/com/wespot/notification/service/InquiryNotificationServiceTest.kt @@ -41,11 +41,16 @@ class InquiryNotificationServiceTest @Autowired constructor( ) // when - val responses = inquiryNotificationService.getNotifications(null, 1).notifications + val responses1 = inquiryNotificationService.getNotifications(null, 1) + val responses2= inquiryNotificationService.getNotifications(responses1.notifications[0].id, 1) // then - responses.size shouldBe 1 - responses[0].id shouldBe savedNotification.id + responses1.notifications.size shouldBe 1 + responses1.notifications[0].id shouldBe savedNotification.id + responses1.hasNext shouldBe true + responses2.notifications.size shouldBe 1 + responses2.notifications[0].id shouldBe notifications[0].id + responses2.hasNext shouldBe false } @Test diff --git a/app/src/test/kotlin/com/wespot/vote/service/ReceivedVoteServiceTest.kt b/app/src/test/kotlin/com/wespot/vote/service/ReceivedVoteServiceTest.kt index 571745d8..e441e327 100644 --- a/app/src/test/kotlin/com/wespot/vote/service/ReceivedVoteServiceTest.kt +++ b/app/src/test/kotlin/com/wespot/vote/service/ReceivedVoteServiceTest.kt @@ -107,20 +107,28 @@ class ReceivedVoteServiceTest @Autowired constructor( ) // when - val receivedVotes = receivedVoteService.getReceivedVotes(null, 100) + val receivedVotes1 = receivedVoteService.getReceivedVotes(null, 100) + val receivedVotes2 = receivedVoteService.getReceivedVotes(null, 1) + val receivedVotes3 = receivedVoteService.getReceivedVotes(receivedVotes2.voteData[0].voteId, 1) // then - receivedVotes.voteData.size shouldBe 2 - receivedVotes.voteData[0].date shouldBe plusOneMinute.toLocalDate().toString() - receivedVotes.voteData[0].receivedVoteResults.size shouldBe 2 - receivedVotes.voteData[0].receivedVoteResults[0].voteOption.id shouldBe voteOptions[5].id - receivedVotes.voteData[0].receivedVoteResults[0].voteCount shouldBe 1 - receivedVotes.voteData[0].receivedVoteResults[0].isNew shouldBe true - receivedVotes.voteData[0].receivedVoteResults[1].voteOption.id shouldBe voteOptions[6].id - receivedVotes.voteData[0].receivedVoteResults[1].voteCount shouldBe 1 - receivedVotes.voteData[0].receivedVoteResults[1].isNew shouldBe true - receivedVotes.voteData[1].date shouldBe now.minusDays(1).toLocalDate().toString() - receivedVotes.voteData[1].receivedVoteResults.size shouldBe 0 + receivedVotes1.voteData.size shouldBe 2 + receivedVotes1.voteData[0].date shouldBe plusOneMinute.toLocalDate().toString() + receivedVotes1.voteData[0].receivedVoteResults.size shouldBe 2 + receivedVotes1.voteData[0].receivedVoteResults[0].voteOption.id shouldBe voteOptions[5].id + receivedVotes1.voteData[0].receivedVoteResults[0].voteCount shouldBe 1 + receivedVotes1.voteData[0].receivedVoteResults[0].isNew shouldBe true + receivedVotes1.voteData[0].receivedVoteResults[1].voteOption.id shouldBe voteOptions[6].id + receivedVotes1.voteData[0].receivedVoteResults[1].voteCount shouldBe 1 + receivedVotes1.voteData[0].receivedVoteResults[1].isNew shouldBe true + receivedVotes1.voteData[1].date shouldBe now.minusDays(1).toLocalDate().toString() + receivedVotes1.voteData[1].receivedVoteResults.size shouldBe 0 + receivedVotes2.voteData.size shouldBe 1 + receivedVotes2.voteData[0].voteId shouldBe vote1!!.id + receivedVotes2.hasNext shouldBe true + receivedVotes3.voteData.size shouldBe 1 + receivedVotes3.voteData[0].voteId shouldBe vote2!!.id + receivedVotes3.hasNext shouldBe false } @Test diff --git a/app/src/test/kotlin/com/wespot/vote/service/SentVoteServiceTest.kt b/app/src/test/kotlin/com/wespot/vote/service/SentVoteServiceTest.kt index ecb2161a..26a1c9c0 100644 --- a/app/src/test/kotlin/com/wespot/vote/service/SentVoteServiceTest.kt +++ b/app/src/test/kotlin/com/wespot/vote/service/SentVoteServiceTest.kt @@ -106,18 +106,27 @@ class SentVoteServiceTest @Autowired constructor( ) // when - val sentVotes = sentVoteService.getSentVotes(null, 100) + val sentVotes1 = sentVoteService.getSentVotes(null, 100) + val sentVotes2 = sentVoteService.getSentVotes(null, 1) + val sentVotes3 = sentVoteService.getSentVotes(sentVotes1.voteData[0].voteId, 1) // then - sentVotes.voteData.size shouldBe 2 - sentVotes.voteData[0].date shouldBe now.toLocalDate().toString() - sentVotes.voteData[0].sentVoteResults.size shouldBe 2 - sentVotes.voteData[0].sentVoteResults[0].vote.voteOption.id shouldBe voteOptions[5].id - sentVotes.voteData[0].sentVoteResults[1].vote.voteOption.id shouldBe voteOptions[7].id - sentVotes.voteData[0].sentVoteResults[0].vote.user.id shouldBe users[1].id - sentVotes.voteData[0].sentVoteResults[1].vote.user.id shouldBe users[2].id - sentVotes.voteData[1].date shouldBe now.minusDays(1).toLocalDate().toString() - sentVotes.voteData[1].sentVoteResults.size shouldBe 0 + sentVotes1.voteData.size shouldBe 2 + sentVotes1.voteData[0].date shouldBe now.toLocalDate().toString() + sentVotes1.voteData[0].sentVoteResults.size shouldBe 2 + sentVotes1.voteData[0].sentVoteResults[0].vote.voteOption.id shouldBe voteOptions[5].id + sentVotes1.voteData[0].sentVoteResults[1].vote.voteOption.id shouldBe voteOptions[7].id + sentVotes1.voteData[0].sentVoteResults[0].vote.user.id shouldBe users[1].id + sentVotes1.voteData[0].sentVoteResults[1].vote.user.id shouldBe users[2].id + sentVotes1.voteData[1].date shouldBe now.minusDays(1).toLocalDate().toString() + sentVotes1.voteData[1].sentVoteResults.size shouldBe 0 + sentVotes1.hasNext shouldBe false + sentVotes2.voteData.size shouldBe 1 + sentVotes2.voteData[0].voteId shouldBe vote1!!.id + sentVotes2.hasNext shouldBe true + sentVotes3.voteData.size shouldBe 1 + sentVotes3.voteData[0].voteId shouldBe vote2!!.id + sentVotes3.hasNext shouldBe false } } diff --git a/core/src/main/kotlin/com/wespot/vote/dto/response/received/ReceivedVotesResponse.kt b/core/src/main/kotlin/com/wespot/vote/dto/response/received/ReceivedVotesResponse.kt index 541f02aa..f3feaa78 100644 --- a/core/src/main/kotlin/com/wespot/vote/dto/response/received/ReceivedVotesResponse.kt +++ b/core/src/main/kotlin/com/wespot/vote/dto/response/received/ReceivedVotesResponse.kt @@ -5,6 +5,7 @@ import com.wespot.vote.VoteRecord import com.wespot.voteoption.VoteOption data class ReceivedVotesResponse( + val voteId: Long, val date: String, val receivedVoteResults: List ) { @@ -13,6 +14,7 @@ data class ReceivedVotesResponse( fun of(vote: Vote, voteResults: Map): ReceivedVotesResponse { return ReceivedVotesResponse( + vote.id, vote.voteIdentifier.date.toString(), voteResults.map { ReceivedVotesResultResponses.of(it.key, it.value) } .toList() diff --git a/core/src/main/kotlin/com/wespot/vote/dto/response/sent/SentVotesResponse.kt b/core/src/main/kotlin/com/wespot/vote/dto/response/sent/SentVotesResponse.kt index 8fe67089..680232d9 100644 --- a/core/src/main/kotlin/com/wespot/vote/dto/response/sent/SentVotesResponse.kt +++ b/core/src/main/kotlin/com/wespot/vote/dto/response/sent/SentVotesResponse.kt @@ -4,6 +4,7 @@ import com.wespot.vote.CompleteBallot import com.wespot.vote.Vote data class SentVotesResponse( + val voteId: Long, val date: String, val sentVoteResults: List ) { @@ -12,6 +13,7 @@ data class SentVotesResponse( fun of(vote: Vote, ballots: List): SentVotesResponse { return SentVotesResponse( + vote.id, vote.voteIdentifier.date.toString(), ballots.map { SentVotesResultsResponse.of(it) } )