Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcruzdev committed Aug 14, 2024
1 parent 875971a commit 229de2a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 17 deletions.
6 changes: 6 additions & 0 deletions asciidoc/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-qute-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.quarkiverse.qute.web.asciidoc.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;

import io.quarkiverse.qute.web.asciidoc.runtime.AsciidocSectionHelperFactory;
Expand All @@ -16,21 +16,37 @@ public class QuarkusAsciidocTest {
public void testAscii() {
Engine engine = Engine.builder().addDefaults()
.addSectionHelper(new AsciidocSectionHelperFactory()).build();
assertEquals("<p>...</p>\n", engine.parse("{#ascii}...{/ascii}").render());

String result = engine.parse("{#ascii}...{/ascii}").render();

assertThat(result).contains("""
<p>
...
</p>
""");
}

@Test
public void testAsciidoc() {
Engine engine = Engine.builder().addDefaults()
.addSectionHelper(new AsciidocSectionHelperFactory()).build();
assertEquals("<p>...</p>\n", engine.parse("{#asciidoc}...{/asciidoc}").render());
}

String result = engine.parse("{#asciidoc}...{/asciidoc}").render();

assertThat(result).contains("""
<p>
...
</p>
"""); }

@Test
public void testH1() {
Engine engine = Engine.builder().addDefaults()
.addSectionHelper(new AsciidocSectionHelperFactory()).build();
assertEquals("<h1>Quarkus and Roq</h1>\n", engine.parse("{#ascii}= Quarkus and Roq{/ascii}").render());

String result = engine.parse("{#ascii}= Quarkus and Roq{/ascii}").render();

assertThat(result).contains("<h1>Quarkus and Roq</h1>");
}

@Test
Expand All @@ -51,16 +67,28 @@ void testJsonObjectValueResolver() {
""").data("items", List.of("apple", "banana", "cherry"))
.render();

Assertions.assertEquals("""
<h1>Quarkus and Qute</h1>
<h1>Qute and Roq</h1>
<p>Here is a list:</p>
<ul>
<li>an apple as a list item</li>
<li>an banana as a list item</li>
<li>an cherry as a list item</li>
</ul>
""", result);

SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).isEqualTo("""
<h1>Quarkus and Qute</h1>
<div class="details">
<span class="author author-1">Here is a list:</span>
<span class="email email-1">Here is a list:</span>
</div>
<div class="ulist">
<ul>
<li>
<p>
an banana as a list item
</p>
</li>
<li>
<p>
an cherry as a list item
</p>
</li>
</ul>
</div>
""");
});
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<quarkus.version>3.6.9</quarkus.version>
<commonmark.version>0.22.0</commonmark.version>
<asciidoc.java.version>1.2.3</asciidoc.java.version>
<assertj.version>3.26.3</assertj.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down

0 comments on commit 229de2a

Please sign in to comment.