forked from jaoafa/VCSpeaker.kt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: x.comの置き換えがされない & picだけ残る問題の修正 (jaoafa#147)
* fix: x.comの置き換えがされない & picだけ残る問題の修正 * test: テストケースの追加 * test: picが正しく置き換えられるテストの追加
- Loading branch information
Showing
2 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import com.jaoafa.vcspeaker.tools.Twitter | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.equals.shouldBeEqual | ||
import io.kotest.matchers.nulls.shouldBeNull | ||
import io.kotest.matchers.nulls.shouldNotBeNull | ||
|
||
class TwitterTest : FunSpec({ | ||
test("getTweet") { | ||
val tweet = Twitter.getTweet("jaoafa", "1685568414084124673") | ||
|
||
tweet.shouldNotBeNull() | ||
tweet.authorName.shouldNotBeNull() | ||
tweet.html.shouldNotBeNull() | ||
tweet.plainText.shouldNotBeNull() | ||
tweet.readText.shouldNotBeNull() | ||
|
||
tweet.authorName shouldBeEqual "jao Community" | ||
tweet.html shouldBeEqual "<blockquote class=\"twitter-tweet\"><p lang=\"ja\" dir=\"ltr\">この度、jao Minecraft Serverでは2023年08月02日 22時00分をもって、Minecraft サーバのサービス提供を終了させていただくこととなりました。<br>利用者のみなさまには、突然のお知らせとなりますことをお詫びいたします。<br><br>7年間、本当にありがとうございました。<a href=\"https://twitter.com/hashtag/jaoafa?src=hash&ref_src=twsrc%5Etfw\">#jaoafa</a></p>— jao Community (@jaoafa) <a href=\"https://twitter.com/jaoafa/status/1685568414084124673?ref_src=twsrc%5Etfw\">July 30, 2023</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n" | ||
tweet.plainText shouldBeEqual "この度、jao Minecraft Serverでは2023年08月02日 22時00分をもって、Minecraft サーバのサービス提供を終了させていただくこととなりました。\n利用者のみなさまには、突然のお知らせとなりますことをお詫びいたします。\n\n7年間、本当にありがとうございました。#jaoafa <https://twitter.com/hashtag/jaoafa?src=hash&ref_src=twsrc%5Etfw>" | ||
tweet.readText shouldBeEqual "この度、jao Minecraft Serverでは2023年08月02日 22時00分をもって、Minecraft サーバのサービス提供を終了させていただくこととなりました。\n利用者のみなさまには、突然のお知らせとなりますことをお詫びいたします。\n\n7年間、本当にありがとうございました。 ハッシュタグ「jaoafa」" | ||
} | ||
|
||
test("getTweet (not found)") { | ||
val tweet = Twitter.getTweet("jaoafa", "0") | ||
|
||
tweet.shouldBeNull() | ||
} | ||
|
||
test("getTweet (with picture)") { | ||
val tweet = Twitter.getTweet("jaoafa", "1775559092742021223") | ||
|
||
tweet.shouldNotBeNull() | ||
tweet.authorName.shouldNotBeNull() | ||
tweet.html.shouldNotBeNull() | ||
tweet.plainText.shouldNotBeNull() | ||
tweet.readText.shouldNotBeNull() | ||
|
||
tweet.authorName shouldBeEqual "jao Community" | ||
tweet.html shouldBeEqual "<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Do you remember when you joined X? I do! <a href=\"https://twitter.com/hashtag/MyXAnniversary?src=hash&ref_src=twsrc%5Etfw\">#MyXAnniversary</a> <a href=\"https://t.co/JbXvgioO6o\">pic.twitter.com/JbXvgioO6o</a></p>— jao Community (@jaoafa) <a href=\"https://twitter.com/jaoafa/status/1775559092742021223?ref_src=twsrc%5Etfw\">April 3, 2024</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n" | ||
tweet.plainText shouldBeEqual "Do you remember when you joined X? I do! #MyXAnniversary <https://twitter.com/hashtag/MyXAnniversary?src=hash&ref_src=twsrc%5Etfw> pic.twitter.com/JbXvgioO6o <https://t.co/JbXvgioO6o>" | ||
tweet.readText shouldBeEqual "Do you remember when you joined X? I do! ハッシュタグ「MyXAnniversary」" | ||
} | ||
}) |