|
4 | 4 | import io.quarkus.test.junit.QuarkusTest; |
5 | 5 | import org.junit.jupiter.api.BeforeAll; |
6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | +import org.wildfly.bot.model.RuntimeConstants; |
7 | 8 | import org.wildfly.bot.utils.TestConstants; |
8 | 9 | import org.wildfly.bot.utils.WildflyGitHubBotTesting; |
9 | 10 | import org.wildfly.bot.utils.mocking.Mockable; |
@@ -81,4 +82,25 @@ void testSkippingFormatCheckOnDraft() throws Throwable { |
81 | 82 | verifyNoMoreInteractions(mocks.pullRequest(pullRequestJson.id())); |
82 | 83 | }); |
83 | 84 | } |
| 85 | + |
| 86 | + @Test |
| 87 | + void testSkippingFormatCheckOnWipLabel() throws Throwable { |
| 88 | + pullRequestJson = TestModel.setPullRequestJsonBuilder( |
| 89 | + pullRequestJsonBuilder -> pullRequestJsonBuilder |
| 90 | + .title(TestConstants.INVALID_TITLE)); |
| 91 | + |
| 92 | + mockedContext = MockedGHPullRequest.builder(pullRequestJson.id()).labels(RuntimeConstants.LABEL_WIP); |
| 93 | + |
| 94 | + TestModel.given(mocks -> WildflyGitHubBotTesting.mockRepo(mocks, wildflyConfigFile, pullRequestJson, mockedContext)) |
| 95 | + .pullRequestEvent(pullRequestJson) |
| 96 | + .then(mocks -> { |
| 97 | + verify(mocks.pullRequest(pullRequestJson.id()), times(2)).getBody(); |
| 98 | + verify(mocks.pullRequest(pullRequestJson.id())).listFiles(); |
| 99 | + verify(mocks.pullRequest(pullRequestJson.id()), times(2)).isDraft(); |
| 100 | + verify(mocks.pullRequest(pullRequestJson.id())).listComments(); |
| 101 | + verify(mocks.pullRequest(pullRequestJson.id()), times(2)).getLabels(); // important for WIP skip check |
| 102 | + // commit status should not be set |
| 103 | + verifyNoMoreInteractions(mocks.pullRequest(pullRequestJson.id())); |
| 104 | + }); |
| 105 | + } |
84 | 106 | } |
0 commit comments