From f2421c1e8ed0a0c8392b179435d638ff55fe1551 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 27 Apr 2024 19:54:16 +0300 Subject: Fix text truncation in reply quotes and Twitter posts --- src/test/java/com/juick/server/tests/ServerTests.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/test/java/com/juick/server/tests') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index a728ac2b..d61725e6 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2693,4 +2693,11 @@ public class ServerTests { .with(httpBasic(ugnichName, ugnichPassword))) .andExpect(status().isBadRequest()); } + @Test + public void textTruncationShouldNotBreakEmojis() { + var text = "Так ты же написал, чтоб я сам поправил отступ \uD83D\uDE00\n"; + var expected = "Так ты же написал, чтоб я сам поправил отступ"; + var truncated = PlainTextFormatter.truncateText(text, 47); + assertThat(truncated, is(expected)); + } } -- cgit v1.2.3