Skip to content

Commit bffe50a

Browse files
author
David Motsonashvili
committed
re-add fixed test
1 parent 3fdd552 commit bffe50a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.google.firebase.ai.util.goldenDevAPIUnaryFile
2424
import io.kotest.assertions.throwables.shouldThrow
2525
import io.kotest.matchers.should
2626
import io.kotest.matchers.shouldBe
27+
import io.kotest.matchers.shouldNotBe
2728
import io.ktor.http.HttpStatusCode
2829
import kotlin.time.Duration.Companion.seconds
2930
import kotlinx.coroutines.withTimeout
@@ -56,6 +57,21 @@ internal class DevAPIUnarySnapshotTests {
5657
}
5758
}
5859

60+
@Test
61+
fun `citation returns correctly`() =
62+
goldenDevAPIUnaryFile("unary-success-citations.json") {
63+
withTimeout(testTimeout) {
64+
val response = model.generateContent("prompt")
65+
66+
response.candidates.isEmpty() shouldBe false
67+
response.candidates.first().citationMetadata?.citations?.size shouldBe 4
68+
response.candidates.first().citationMetadata?.citations?.forEach {
69+
it.startIndex shouldNotBe null
70+
it.endIndex shouldNotBe null
71+
}
72+
}
73+
}
74+
5975
@Test
6076
fun `response blocked for safety`() =
6177
goldenDevAPIUnaryFile("unary-failure-finish-reason-safety.txt") {

firebase-ai/update_responses.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# This script replaces mock response files for Vertex AI unit tests with a fresh
1818
# clone of the shared repository of Vertex AI test data.
1919

20-
RESPONSES_VERSION='v10.*' # The major version of mock responses to use
20+
RESPONSES_VERSION='v11.*' # The major version of mock responses to use
2121
REPO_NAME="vertexai-sdk-test-data"
2222
REPO_LINK="https://github.com/FirebaseExtended/$REPO_NAME.git"
2323

0 commit comments

Comments
 (0)