|
8 | 8 |
|
9 | 9 | import org.junit.jupiter.api.BeforeEach; |
10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | +import software.amazon.smithy.python.codegen.writer.MarkdownToRstDocConverter; |
11 | 12 |
|
12 | | -public class AwsDocConverterTest { |
| 13 | +public class MarkdownToRstDocConverterTest { |
13 | 14 |
|
14 | | - private AwsDocConverter awsDocConverter; |
| 15 | + private MarkdownToRstDocConverter markdownToRstDocConverter; |
15 | 16 |
|
16 | 17 | @BeforeEach |
17 | 18 | public void setUp() { |
18 | | - awsDocConverter = new AwsDocConverter(); |
| 19 | + markdownToRstDocConverter = new MarkdownToRstDocConverter(); |
19 | 20 | } |
20 | 21 |
|
21 | 22 | @Test |
22 | | - public void testConvertHtmlToRstWithTitleAndParagraph() { |
| 23 | + public void testConvertCommonmarkToRstWithTitleAndParagraph() { |
23 | 24 | String html = "<html><body><h1>Title</h1><p>Paragraph</p></body></html>"; |
24 | 25 | String expected = "\n\nTitle\n=====\nParagraph\n"; |
25 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 26 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
26 | 27 | assertEquals(expected, result); |
27 | 28 | } |
28 | 29 |
|
29 | 30 | @Test |
30 | | - public void testConvertHtmlToRstWithImportantNote() { |
| 31 | + public void testConvertCommonmarkToRstWithImportantNote() { |
31 | 32 | String html = "<html><body><important>Important note</important></body></html>"; |
32 | 33 | String expected = "\n\n.. important::\n Important note\n"; |
33 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 34 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
34 | 35 | assertEquals(expected, result); |
35 | 36 | } |
36 | 37 |
|
37 | 38 | @Test |
38 | | - public void testConvertHtmlToRstWithList() { |
| 39 | + public void testConvertCommonmarkToRstWithList() { |
39 | 40 | String html = "<html><body><ul><li>Item 1</li><li>Item 2</li></ul></body></html>"; |
40 | 41 | String expected = "\n\n* Item 1\n\n* Item 2\n\n"; |
41 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 42 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
42 | 43 | assertEquals(expected, result); |
43 | 44 | } |
44 | 45 |
|
45 | 46 | @Test |
46 | | - public void testConvertHtmlToRstWithMixedElements() { |
| 47 | + public void testConvertCommonmarkToRstWithMixedElements() { |
47 | 48 | String html = "<html><body><h1>Title</h1><p>Paragraph</p><ul><li>Item 1</li><li>Item 2</li></ul></body></html>"; |
48 | 49 | String expected = "\n\nTitle\n=====\nParagraph\n\n* Item 1\n\n* Item 2\n\n"; |
49 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 50 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
50 | 51 | assertEquals(expected, result); |
51 | 52 | } |
52 | 53 |
|
53 | 54 | @Test |
54 | | - public void testConvertHtmlToRstWithNestedElements() { |
| 55 | + public void testConvertCommonmarkToRstWithNestedElements() { |
55 | 56 | String html = "<html><body><h1>Title</h1><p>Paragraph with <strong>bold</strong> text</p></body></html>"; |
56 | 57 | String expected = "\n\nTitle\n=====\nParagraph with **bold** text\n"; |
57 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 58 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
58 | 59 | assertEquals(expected, result); |
59 | 60 | } |
60 | 61 |
|
61 | 62 | @Test |
62 | | - public void testConvertHtmlToRstWithAnchorTag() { |
| 63 | + public void testConvertCommonmarkToRstWithAnchorTag() { |
63 | 64 | String html = "<html><body><a href='https://example.com'>Link</a></body></html>"; |
64 | 65 | String expected = "\n`Link <https://example.com>`_"; |
65 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 66 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
66 | 67 | assertEquals(expected, result); |
67 | 68 | } |
68 | 69 |
|
69 | 70 | @Test |
70 | | - public void testConvertHtmlToRstWithBoldTag() { |
| 71 | + public void testConvertCommonmarkToRstWithBoldTag() { |
71 | 72 | String html = "<html><body><b>Bold text</b></body></html>"; |
72 | 73 | String expected = "\n**Bold text**"; |
73 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 74 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
74 | 75 | assertEquals(expected, result); |
75 | 76 | } |
76 | 77 |
|
77 | 78 | @Test |
78 | | - public void testConvertHtmlToRstWithItalicTag() { |
| 79 | + public void testConvertCommonmarkToRstWithItalicTag() { |
79 | 80 | String html = "<html><body><i>Italic text</i></body></html>"; |
80 | 81 | String expected = "\n*Italic text*"; |
81 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 82 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
82 | 83 | assertEquals(expected, result); |
83 | 84 | } |
84 | 85 |
|
85 | 86 | @Test |
86 | | - public void testConvertHtmlToRstWithCodeTag() { |
| 87 | + public void testConvertCommonmarkToRstWithCodeTag() { |
87 | 88 | String html = "<html><body><code>code snippet</code></body></html>"; |
88 | 89 | String expected = "\n``code snippet``"; |
89 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 90 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
90 | 91 | assertEquals(expected, result); |
91 | 92 | } |
92 | 93 |
|
93 | 94 | @Test |
94 | | - public void testConvertHtmlToRstWithNoteTag() { |
| 95 | + public void testConvertCommonmarkToRstWithNoteTag() { |
95 | 96 | String html = "<html><body><note>Note text</note></body></html>"; |
96 | 97 | String expected = "\n\n.. note::\n Note text\n"; |
97 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 98 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
98 | 99 | assertEquals(expected, result); |
99 | 100 | } |
100 | 101 |
|
101 | 102 | @Test |
102 | | - public void testConvertHtmlToRstWithNestedList() { |
| 103 | + public void testConvertCommonmarkToRstWithNestedList() { |
103 | 104 | String html = "<html><body><ul><li>Item 1<ul><li>Subitem 1</li></ul></li><li>Item 2</li></ul></body></html>"; |
104 | 105 | String expected = "\n\n* Item 1\n * Subitem 1\n\n* Item 2\n\n"; |
105 | | - String result = awsDocConverter.convertHtmlToRst(html); |
| 106 | + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); |
106 | 107 | assertEquals(expected, result); |
107 | 108 | } |
108 | 109 | } |
0 commit comments