diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt index f5ff2cb..b0b5a28 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt @@ -47,16 +47,11 @@ class Gemini2Test : LocalProperties() { @DisplayName("Chat Tests") inner class ChatTests { private val apiKey = getProperty(Gemini2.GEMINI_API_KEY) + private val maxTokens = getProperty(Gemini2.MAX_TOKENS_PROP).toInt() @Test @DisableOnCi fun chatHttpRequestInJavascript() { - val maxTokens = try { - getProperty(Gemini2.MAX_TOKENS_PROP).toInt() - } catch (_: NumberFormatException) { - 1024 - } - assertThat( Gemini2.chat( "javascript function to make a request with XMLHttpRequest, just code", diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt index a5bce34..0edbaa5 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt @@ -113,30 +113,21 @@ class GoogleSearchTest : LocalProperties() { @Test fun `API key should not be empty`() { assertFailure { sanitizedSearch("test", "", "apiKey") } - .isInstanceOf(ModuleException::class.java) - .hasMessage("${GoogleSearch.SERVICE_NAME} is disabled. The API keys are missing.") + .isInstanceOf(ModuleException::class.java).hasNoCause() } @Test - fun `CSE key should not be empty`() { + fun `CSE key should not empty`() { assertFailure { sanitizedSearch("test", "apiKey", "") } - .isInstanceOf(ModuleException::class.java) - .hasMessage("${GoogleSearch.SERVICE_NAME} is disabled. The API keys are missing.") + .isInstanceOf(ModuleException::class.java).hasNoCause() } @Test fun `Invalid API key should throw exception`() { - assertFailure { sanitizedSearch("test", "apiKey", "cseKey") } + assertFailure { sanitizedSearch("test", "apiKey", "cssKey") } .isInstanceOf(ModuleException::class.java) .hasMessage("API key not valid. Please pass a valid API key.") } - - @Test - fun `Invalid CSE key should throw exception`() { - assertFailure { sanitizedSearch("test", apiKey, "cseKey") } - .isInstanceOf(ModuleException::class.java) - .hasMessage("Request contains an invalid argument.") - } } @Nested