Skip to content

Commit 394c321

Browse files
committed
Address broken tests
Tests were failing because they were looking at the finish reason in every data chunck instead of the last one.
1 parent fc66bf6 commit 394c321

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ internal class DevAPIStreamingSnapshotTests {
4242
withTimeout(testTimeout) {
4343
val responseList = responses.toList()
4444
responseList.isEmpty() shouldBe false
45-
responseList.first().candidates.first().finishReason shouldBe FinishReason.STOP
46-
responseList.first().candidates.first().content.parts.isEmpty() shouldBe false
47-
responseList.first().candidates.first().safetyRatings.isEmpty() shouldBe false
45+
responseList.last().candidates.first().let {
46+
it.finishReason shouldBe FinishReason.STOP
47+
it.content.parts.isEmpty() shouldBe false
48+
}
4849
}
4950
}
5051

@@ -56,10 +57,9 @@ internal class DevAPIStreamingSnapshotTests {
5657
withTimeout(testTimeout) {
5758
val responseList = responses.toList()
5859
responseList.isEmpty() shouldBe false
59-
responseList.forEach {
60-
it.candidates.first().finishReason shouldBe FinishReason.STOP
61-
it.candidates.first().content.parts.isEmpty() shouldBe false
62-
it.candidates.first().safetyRatings.isEmpty() shouldBe false
60+
responseList.last().candidates.first().let {
61+
it.finishReason shouldBe FinishReason.STOP
62+
it.content.parts.isEmpty() shouldBe false
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)