diff options
author | Vitaly Takmazov | 2018-07-26 12:42:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-07-26 12:44:12 +0300 |
commit | 264bd16c937c48b2af77473944217496fae0aa3d (patch) | |
tree | e84304d609de95bf0359c369a7643a63ad3376c1 /juick-common/src/test/java/com/juick | |
parent | 91bd51c87c715954e21e96948db11aa980dcbeb2 (diff) |
Multiple trivial fixes
* https links in posts
* escape reply numbers for telegram
* catch when non safe url can not be stripped
Diffstat (limited to 'juick-common/src/test/java/com/juick')
-rw-r--r-- | juick-common/src/test/java/com/juick/MessageTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/juick-common/src/test/java/com/juick/MessageTest.java b/juick-common/src/test/java/com/juick/MessageTest.java index 7d11503d..aaa66af2 100644 --- a/juick-common/src/test/java/com/juick/MessageTest.java +++ b/juick-common/src/test/java/com/juick/MessageTest.java @@ -156,4 +156,16 @@ public class MessageTest { assertThat(StringUtils.countMatches(MessageUtils.getTagsString(message), "*test"), equalTo(1)); assertThat(StringUtils.countMatches(MessageUtils.getTagsString(message), "*ab"), equalTo(1)); } + @Test + public void markdownContentShouldNotHaveUnescapedReplyNumbersBecauseOfTelegram() { + Message msg = new Message(); + msg.setMid(1); + msg.setText("See /303 again"); + assertThat(MessageUtils.formatMarkdownText(msg), is("See [/303](https://juick.com/m/1#303) again")); + } + @Test + public void shouldNotThrowIfUrlContainsIllegalCharacters() { + String msg = "[te](http://juick.com/)[st](http://juick.com/)"; + assertThat(MessageUtils.stripNonSafeUrls(msg), is(msg)); + } } |