Skip to content

Commit

Permalink
Use array indexes in tests (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller authored Feb 5, 2024
1 parent cfa2ce9 commit 8ff5e2a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Tests/LayoutTests/UIKit/UIView+AutoLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .width }?.constant) == frame.width
expect(view.constraints.first { $0.firstAttribute == .height }?.constant) == frame.height
expect(view.constraints[0].constant) == frame.width
expect(view.constraints[1].constant) == frame.height
}

func testConstrainingSize() {
Expand All @@ -69,8 +69,8 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .width }?.constant) == size.width
expect(view.constraints.first { $0.firstAttribute == .height }?.constant) == size.height
expect(view.constraints[0].constant) == size.width
expect(view.constraints[1].constant) == size.height
}

func testConstrainingWidth_givenDefaults() {
Expand All @@ -91,7 +91,7 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .width }?.constant) == width
expect(view.constraints[0].constant) == width
}

func testConstrainingWidth() {
Expand All @@ -112,7 +112,7 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .width }?.constant) == width
expect(view.constraints[0].constant) == width
}

func testConstrainingHeight_givenDefaults() {
Expand All @@ -133,7 +133,7 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .height }?.constant) == height
expect(view.constraints[0].constant) == height
}

func testConstrainingHeight() {
Expand All @@ -154,7 +154,7 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(view.translatesAutoresizingMaskIntoConstraints) == false
expect(view.constraints.first { $0.firstAttribute == .height }?.constant) == height
expect(view.constraints[0].constant) == height
}

// MARK: - Size
Expand Down

0 comments on commit 8ff5e2a

Please sign in to comment.