Skip to content

Commit 478c751

Browse files
committed
Fix test cases
- Update which files contain the right test data - Remove unnecessary tests inhereted from genai-common
1 parent 10f9e92 commit 478c751

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/StreamingSnapshotTests.kt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ internal class StreamingSnapshotTests {
6969

7070
@Test
7171
fun `unknown enum`() =
72-
goldenStreamingFile("success-unknown-enum.txt") {
72+
goldenStreamingFile("success-unknown-safety-enum.txt") {
7373
val responses = apiController.generateContentStream(textGenerateContentRequest("prompt"))
7474

7575
withTimeout(testTimeout) {
@@ -152,20 +152,6 @@ internal class StreamingSnapshotTests {
152152
}
153153
}
154154

155-
@Test
156-
fun `citation returns correctly when using alternative name`() =
157-
goldenStreamingFile("success-citations-altname.txt") {
158-
val responses = apiController.generateContentStream(textGenerateContentRequest("prompt"))
159-
160-
withTimeout(testTimeout) {
161-
val responseList = responses.toList()
162-
responseList.any {
163-
it.candidates?.any { it.citationMetadata?.citationSources?.isNotEmpty() ?: false }
164-
?: false
165-
} shouldBe true
166-
}
167-
}
168-
169155
@Test
170156
fun `stopped for recitation`() =
171157
goldenStreamingFile("failure-recitation-no-content.txt") {

firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/UnarySnapshotTests.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal class UnarySnapshotTests {
7575

7676
@Test
7777
fun `unknown enum`() =
78-
goldenUnaryFile("success-unknown-enum.json") {
78+
goldenUnaryFile("success-unknown-enum-safety-ratings.json") {
7979
withTimeout(testTimeout) {
8080
val response = apiController.generateContent(textGenerateContentRequest("prompt"))
8181

@@ -211,17 +211,6 @@ internal class UnarySnapshotTests {
211211
}
212212
}
213213

214-
@Test
215-
fun `citation returns correctly when using alternative name`() =
216-
goldenUnaryFile("success-citations-altname.json") {
217-
withTimeout(testTimeout) {
218-
val response = apiController.generateContent(textGenerateContentRequest("prompt"))
219-
220-
response.candidates?.isEmpty() shouldBe false
221-
response.candidates?.first()?.citationMetadata?.citationSources?.isNotEmpty() shouldBe true
222-
}
223-
}
224-
225214
@OptIn(ExperimentalSerializationApi::class)
226215
@Test
227216
fun `properly translates json text`() =
@@ -306,7 +295,7 @@ internal class UnarySnapshotTests {
306295

307296
@Test
308297
fun `service disabled`() =
309-
goldenUnaryFile("failure-service-disabled.json", HttpStatusCode.Forbidden) {
298+
goldenUnaryFile("failure-firebaseml-api-not-enabled.json", HttpStatusCode.Forbidden) {
310299
withTimeout(testTimeout) {
311300
shouldThrow<ServiceDisabledException> {
312301
apiController.generateContent(textGenerateContentRequest("prompt"))

0 commit comments

Comments
 (0)