Skip to content

Commit

Permalink
Change isReviewed -> isApproved (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
schlagelk authored Oct 29, 2021
1 parent 751a9b1 commit 5e36e2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Sources/mariachiLib/GitHub/GitHubModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class Review: Decodable {
state
}

var isReviewed: Bool {
var isApproved: Bool {
reviewState == "APPROVED"
}
}
Expand All @@ -100,7 +100,7 @@ public extension Array where Element: PullRequest {
func needing(minApprovals: Int) -> [PullRequest] {
var needingApprovalsTemp = [PullRequest]()
for pull in self {
let validReviews = pull.reviews?.filter { $0.isReviewed }.uniquingReviewers.count ?? 0
let validReviews = pull.reviews?.filter { $0.isApproved }.uniquingReviewers.count ?? 0
if validReviews < minApprovals {
needingApprovalsTemp.append(pull)
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/mariachiUnitTests/MariachiUnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ final class MariachiUnitTests: XCTestCase {
let reviewData = try JSONSerialization.data(withJSONObject: reviewsData, options: [])
let reviews = try JSONDecoder().decode([Review].self, from: reviewData)

XCTAssertTrue(reviews[0].isReviewed)
XCTAssertTrue(reviews[1].isReviewed)
XCTAssertFalse(reviews[2].isReviewed)
XCTAssertTrue(reviews[0].isApproved)
XCTAssertFalse(reviews[1].isApproved)
XCTAssertFalse(reviews[2].isApproved)
}

func testUniquingUsers() throws {
Expand Down

0 comments on commit 5e36e2b

Please sign in to comment.