test/test_chatgpt.rb in jekyll-chatgpt-translate-0.0.23 vs test/test_chatgpt.rb in jekyll-chatgpt-translate-0.0.24
- old
+ new
@@ -35,9 +35,16 @@
def test_short_text
chat = GptTranslate::ChatGPT.new('fake-key', 'foo', 'xx', 'xx')
assert_equal('Hello, world!', chat.translate('Hello, world!'))
end
+ def test_start_with_link
+ stub_request(:any, 'https://api.openai.com/v1/chat/completions')
+ .to_return(body: '{"choices":[{"message":{"content": "done!"}}]}')
+ chat = GptTranslate::ChatGPT.new('fake-key', 'gpt-3.5-turbo', 'en', 'ru')
+ assert_equal('done!', chat.translate('[OpenAI](https://openai.com) is the creator of ChatGPT', min: 10))
+ end
+
def test_dry_mode
chat = GptTranslate::ChatGPT.new('', 'foo', 'xx', 'xx')
assert_equal(38, chat.translate('This text should not be sent to OpenAI', min: 100).length)
end