Skip to content

Commit

Permalink
Move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-garricnahapetian committed Oct 25, 2023
1 parent 18fc248 commit 837abc9
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 84 deletions.
84 changes: 0 additions & 84 deletions Tests/LayoutTests/LayoutAnchoringTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,90 +142,6 @@ final class LayoutAnchoringTests: XCTestCase {
expect(layoutSupport.height) == view.height
}

func testConstraintToXAnchor_withDefaults() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(equalTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withConstant() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(equalTo: viewB.centerX, constant: 50)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .equal, to: viewB.centerX, constant: 50)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withGreaterThanOrEqualRelation() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(greaterThanOrEqualTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .greaterThanOrEqual, to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withLessThanOrEqualRelation() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(lessThanOrEqualTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .lessThanOrEqual, to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToYAnchor_withDefaults() {

// GIVEN
Expand Down
100 changes: 100 additions & 0 deletions Tests/LayoutTests/NSLayoutXAxisAnchorTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//
// All Contributions by Match Group
//
// Copyright © 2023 Tinder (Match Group, LLC)
//
// Licensed under the Match Group Modified 3-Clause BSD License.
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Nimble
import XCTest

@MainActor
final class NSLayoutXAxisAnchorTests: XCTestCase {

func testConstraintToXAnchor_withDefaults() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(equalTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withConstant() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(equalTo: viewB.centerX, constant: 50)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .equal, to: viewB.centerX, constant: 50)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withGreaterThanOrEqualRelation() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(greaterThanOrEqualTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .greaterThanOrEqual, to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}

func testConstraintToXAnchor_withLessThanOrEqualRelation() {

// GIVEN

let viewA: UIView = .init()
let viewB: UIView = .init()
let expected: NSLayoutConstraint = viewA
.centerX
.constraint(lessThanOrEqualTo: viewB.centerX)

// WHEN

let constraint: NSLayoutConstraint = viewA
.centerX
.constraint(is: .lessThanOrEqual, to: viewB.centerX)

// THEN

expect(constraint).to(match(expected))
}
}

0 comments on commit 837abc9

Please sign in to comment.