Skip to content

Commit

Permalink
feat(#1682): add more tests to check title
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed May 13, 2023
1 parent 74fd67c commit db0fa17
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/rultor/agents/github/CommentsTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.io.IOException;
import java.net.URI;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.ResourceBundle;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final class QnParametrizedTest {
public void fetchesParams() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Issue issue = repo.issues().create("", "");
issue.comments().post("hey, tag=`1.9` and server is `p5`");
issue.comments().post("hey, tag=`1.9` and server is `p5`, title is `Version 1.9.0`");
final Question origin = new Question() {
@Override
public Req understand(final Comment.Smart comment, final URI home) {
Expand All @@ -87,9 +87,10 @@ public Iterable<Directive> dirs() {
).xml(),
XhtmlMatchers.hasXPaths(
"/request[type='xxx']",
"/request/args[count(arg) = 3]",
"/request/args[count(arg) = 4]",
"/request/args/arg[@name='tag' and .='1.9']",
"/request/args/arg[@name='server' and .='p5']"
"/request/args/arg[@name='server' and .='p5']",
"/request/args/arg[@name='title' and .='Version 1.9.0']"
)
);
}
Expand Down
28 changes: 28 additions & 0 deletions src/test/java/com/rultor/agents/github/qtn/QnReleaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import com.jcabi.github.mock.MkGithub;
import com.jcabi.matchers.XhtmlMatchers;
import com.rultor.agents.github.Req;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -129,4 +131,30 @@ public void denyOutdatedTag() throws Exception {
);
}

/**
* QnRelease can accept release title.
* @throws Exception In case of error
*/
@Test
public void allowsToSetReleaseTitle() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Issue issue = repo.issues().create("", "");
issue.comments().post("release `1.8`, title `Version 1.8.0`");
MatcherAssert.assertThat(
new Xembler(
new Directives().add("request").append(
new QnRelease().understand(
new Comment.Smart(issue.comments().get(1)), new URI("#")
).dirs()
)
).xml(),
XhtmlMatchers.hasXPaths(
"/request[type='release']",
"/request/args[count(arg) = 2]",
"/request/args/arg[@name='head']",
"/request/args/arg[@name='head_branch']"
)
);
}

}

0 comments on commit db0fa17

Please sign in to comment.