Skip to content

Commit

Permalink
remove erroneous tests
Browse files Browse the repository at this point in the history
  • Loading branch information
David Motsonashvili committed May 21, 2024
1 parent 5f2d09e commit d3e23ce
Showing 1 changed file with 0 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,60 +135,6 @@ internal class RequestFormatTests {
mockEngine.requestHistory.first().url.host shouldBe "my.custom.endpoint"
}

@Test
fun `generateContentRequest doesn't include the model name`() = doBlocking {
val channel = ByteChannel(autoFlush = true)
val mockEngine = MockEngine {
respond(channel, HttpStatusCode.OK, headersOf(HttpHeaders.ContentType, "application/json"))
}
prepareStreamingResponse(createResponses("Random")).forEach { channel.writeFully(it) }
val controller =
APIController(
"super_cool_test_key",
"gemini-pro-1.0",
RequestOptions(),
mockEngine,
TEST_CLIENT_ID,
null
)

withTimeout(5.seconds) {
controller.generateContentStream(textGenerateContentRequest("cats")).collect {
it.candidates?.isEmpty() shouldBe false
channel.close()
}
}

val requestBodyAsText = (mockEngine.requestHistory.first().body as TextContent).text
requestBodyAsText shouldContainJsonKey "contents"
requestBodyAsText shouldNotContainJsonKey "model"
}

@Test
fun `countTokenRequest doesn't include the model name`() = doBlocking {
val response =
JSON.encodeToString(CountTokensResponse(totalTokens = 10, totalBillableCharacters = 10))
val mockEngine = MockEngine {
respond(response, HttpStatusCode.OK, headersOf(HttpHeaders.ContentType, "application/json"))
}

val controller =
APIController(
"super_cool_test_key",
"gemini-pro-1.0",
RequestOptions(),
mockEngine,
TEST_CLIENT_ID,
null
)

withTimeout(5.seconds) { controller.countTokens(textCountTokenRequest("cats")) }

val requestBodyAsText = (mockEngine.requestHistory.first().body as TextContent).text
requestBodyAsText shouldContainJsonKey "contents"
requestBodyAsText shouldNotContainJsonKey "model"
}

@Test
fun `client id header is set correctly in the request`() = doBlocking {
val response = JSON.encodeToString(CountTokensResponse(totalTokens = 10))
Expand Down

0 comments on commit d3e23ce

Please sign in to comment.