Skip to content

Commit ec91c1f

Browse files
committed
Fix tests checking issue type with IssueType values
1 parent f4ccda3 commit ec91c1f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Diff for: src/test/scala/IssueOpSpec.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.joda.time.DateTimeZone
77
import codecheck.github.models.IssueListOption
88
import codecheck.github.models.IssueFilter
99
import codecheck.github.models.IssueListOption4Repository
10+
import codecheck.github.models.IssueState
1011
import codecheck.github.models.IssueStateFilter
1112
import codecheck.github.models.Issue
1213
import codecheck.github.models.IssueInput
@@ -39,7 +40,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
3940
assert(result.title == "test issue")
4041
assert(result.user.login == user)
4142
assert(result.labels.head.name == "question")
42-
assert(result.state == "open")
43+
assert(result.state == IssueState.open)
4344
assert(result.locked == false)
4445
assert(result.assignee.get.login == user)
4546
assert(result.comments == 0)
@@ -61,7 +62,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
6162
assert(result.title == "test issue")
6263
assert(result.user.login == user)
6364
assert(result.labels.isEmpty) //Label is not set if user is not the organization member.
64-
assert(result.state == "open")
65+
assert(result.state == IssueState.open)
6566
assert(result.locked == false)
6667
assert(result.assignee.isEmpty) //Assignee is not set if user is not the organization member.
6768
assert(result.milestone.isEmpty) //Assignee is not set if user is not the organization member.
@@ -172,7 +173,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
172173
assert(result.title == "test issue edited")
173174
assert(result.body.get == "testing again")
174175
assert(result.labels.head.name == "bug")
175-
assert(result.state == "closed")
176+
assert(result.state == IssueState.closed)
176177
assert(result.updated_at.toDateTime(DateTimeZone.UTC).getMillis() - DateTime.now(DateTimeZone.UTC).getMillis() <= 5000)
177178
}
178179

@@ -182,7 +183,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
182183
assert(result.body.get == "testing again")
183184
assert(result.milestone.isEmpty)
184185
assert(result.labels.isEmpty)
185-
assert(result.state == "closed")
186+
assert(result.state == IssueState.closed)
186187
assert(result.updated_at.toDateTime(DateTimeZone.UTC).getMillis() - DateTime.now(DateTimeZone.UTC).getMillis() <= 5000)
187188
}
188189
}

Diff for: src/test/scala/PullRequestOpSpec.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.scalatest.FunSpec
22
import scala.concurrent.Await
33

4+
import codecheck.github.models.IssueState
45
import codecheck.github.models.PullRequestInput
56
import java.util.Date
67

@@ -10,7 +11,7 @@ class PullRequestOpSpec extends FunSpec with Constants {
1011
it("with valid repo should succeed") {
1112
val list = Await.result(api.listPullRequests(otherUser, otherUserRepo), TIMEOUT)
1213
assert(list.length >= 0)
13-
assert(list.exists(_.state == "open"))
14+
assert(list.exists(_.state == IssueState.open))
1415
assert(list.exists(_.base.repo.full_name == s"$otherUser/$otherUserRepo"))
1516
assert(list.exists(_.base.user.login == otherUser))
1617
assert(list.exists(_.base.repo.name == otherUserRepo))
@@ -26,11 +27,11 @@ class PullRequestOpSpec extends FunSpec with Constants {
2627
val input = PullRequestInput(title, "githubapi-test-pr", "master", Some("PullRequest body"))
2728
val result = Await.result(api.createPullRequest(username, reponame, input), TIMEOUT)
2829
assert(result.title == title)
29-
assert(result.state == "open")
30+
assert(result.state == IssueState.open)
3031

3132
val result2 = Await.result(api.closePullRequest(username, reponame, result.number), TIMEOUT)
3233
assert(result2.title == title)
33-
assert(result2.state == "closed")
34+
assert(result2.state == IssueState.closed)
3435
}
3536

3637
}

Diff for: src/test/scala/events/GitHubEventSpec.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class GitHubEventSpec extends FunSpec with Matchers with Inside
3636
assert(issue.title === "Spelling error in the README file")
3737
}
3838
it("should have a state") {
39-
assert(issue.state === "open")
39+
assert(issue.state === models.IssueState.open)
4040
}
4141
it("should have a body") {
4242
val exp = "It looks like you accidently spelled 'commit' with two 't's."
@@ -77,7 +77,7 @@ class GitHubEventSpec extends FunSpec with Matchers with Inside
7777
assert(pr.title === "Update the README with new information")
7878
}
7979
it("should have a state") {
80-
assert(pr.state === "open")
80+
assert(pr.state === models.IssueState.open)
8181
}
8282
it("should have a body") {
8383
val exp = "This is a pretty simple change that we need to pull into master."

0 commit comments

Comments
 (0)