🌐 AI搜索 & 代理 主页
Skip to content

Commit b54d8db

Browse files
committed
[ADDED] More test case with data
Now prints ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PR: Tests: Exclude tests based on compilation flags, not API presence (jquery/jquery#5046) PR Available: May 23, 2022, 12:02:33 PM Review Time: {timmywil=35d 0h 25m 43s} PR Merged in: 35d 18h 36m 29s on Jun 28, 2022, 6:39:02 AM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ```
1 parent 0dfa3b4 commit b54d8db

File tree

5 files changed

+512
-3
lines changed

5 files changed

+512
-3
lines changed

src/main/kotlin/dev/hossain/githubstats/PullStats.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class PullStats(private val githubService: GithubService) {
4343

4444
println("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
4545

46+
println("PR: ${pullRequest.title} (${pullRequest.html_url})")
4647
println("PR Available: ${dateFormatter.format(prAvailableForReview.toJavaInstant())}")
4748
println("Review Time: $reviewCompletionInfo")
4849
println(

src/main/kotlin/dev/hossain/githubstats/model/PullRequest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ data class PullRequest(
88
val state: String,
99
val title: String,
1010
val url: String,
11+
val html_url: String,
1112
val created_at: String,
1213
val updated_at: String?,
1314
val closed_at: String?,

src/test/kotlin/dev/hossain/githubstats/PullStatsTest.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ internal class PullStatsTest {
4747

4848
@Test
4949
fun `calculateStats - given merged with no reviewer - provides no related metrics`() = runTest {
50-
// Uses data from https://github.com/square/retrofit/pull/3114
51-
mockWebServer.enqueue(MockResponse().setBody(respond("pulls-retrofit-3114.json")))
52-
mockWebServer.enqueue(MockResponse().setBody(respond("timeline-retrofit-3114.json")))
50+
// Uses data from https://github.com/hossain-khan/github-stats/pull/27
51+
mockWebServer.enqueue(MockResponse().setBody(respond("pulls-githubstats-27.json")))
52+
mockWebServer.enqueue(MockResponse().setBody(respond("timeline-githubstats-27.json")))
5353

5454
val calculateStats = pullStats.calculateStats(123)
5555

@@ -63,6 +63,14 @@ internal class PullStatsTest {
6363

6464
@Test
6565
fun `calculateStats - given no assigned reviewer added - provides metrics based on approval event`() = runTest {
66+
// Uses data from https://github.com/square/retrofit/pull/3114
67+
mockWebServer.enqueue(MockResponse().setBody(respond("pulls-retrofit-3114.json")))
68+
mockWebServer.enqueue(MockResponse().setBody(respond("timeline-retrofit-3114.json")))
69+
70+
val calculateStats = pullStats.calculateStats(123)
71+
72+
// TODO Test requires update based on return data
73+
assertThat(calculateStats).isInstanceOf(PullStats.StatsResult.Failure::class.java)
6674
}
6775

6876
// region: Test Utility Functions

0 commit comments

Comments
 (0)