feat(system): 支持后台维护三语协议
This commit is contained in:
1 parent
16ba79a336
commit
22edf34ff1
12 files changed
+470
No files matched your search
@@ -0,0 +1,33 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
package com.fruitshorts.app.service;
|
||||
|
||||
import com.fruitshorts.system.service.LegalPageHtml;
|
||||
import com.fruitshorts.system.service.LegalPages;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class LegalPageHtmlTest {
|
||||
|
||||
@Test
|
||||
void should_render_markdown_without_an_extra_title() {
|
||||
String html = LegalPageHtml.render("zh", "第一行\n\n<script>alert(1)</script>\n\n**粗体**");
|
||||
|
||||
assertTrue(html.contains("<html lang=\"zh\">"));
|
||||
assertFalse(html.contains("<h1>"));
|
||||
assertTrue(html.contains("<p>第一行</p>"));
|
||||
assertTrue(html.contains("<script>"));
|
||||
assertTrue(html.contains("<strong>粗体</strong>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_map_public_paths_to_document_codes() {
|
||||
assertEquals(LegalPages.PRIVACY, LegalPages.docCodeOfPath("privacy"));
|
||||
assertEquals(LegalPages.TERMS, LegalPages.docCodeOfPath("terms"));
|
||||
assertNull(LegalPages.docCodeOfPath("other"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user