-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88dfa42
commit 7b7570f
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...ePaymentSheet/StripePaymentSheetTests/PaymentSheet/BankAccountInfoViewSnapshotTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// BankAccountInfoViewSnapshotTests.swift | ||
// StripePaymentSheetTests | ||
// | ||
// Created by Till Hellmund on 12/17/24. | ||
// | ||
|
||
import StripeCoreTestUtils | ||
import UIKit | ||
@testable import StripePaymentSheet | ||
|
||
final class BankAccountInfoViewSnapshotTests : STPSnapshotTestCase { | ||
|
||
private static let frame = CGRect(x: 0, y: 0, width: 320, height: 1000) | ||
|
||
func test_noPromoBadge() { | ||
let view = BankAccountInfoView( | ||
frame: Self.frame, | ||
theme: .default, | ||
incentive: nil | ||
) | ||
view.setBankName(text: "Stripe Bank") | ||
view.setLastFourOfBank(text: "•••• 4242") | ||
view.setIncentiveEligible(false) | ||
|
||
verify(view) | ||
} | ||
|
||
func test_eligibleForPromo() { | ||
let view = BankAccountInfoView( | ||
frame: Self.frame, | ||
theme: .default, | ||
incentive: .init(identifier: "link_instant_debits", displayText: "$5") | ||
) | ||
view.setBankName(text: "Stripe Bank") | ||
view.setLastFourOfBank(text: "•••• 4242") | ||
view.setIncentiveEligible(true) | ||
|
||
verify(view) | ||
} | ||
|
||
func test_ineligibleForPromo() { | ||
let view = BankAccountInfoView( | ||
frame: Self.frame, | ||
theme: .default, | ||
incentive: .init(identifier: "link_instant_debits", displayText: "$5") | ||
) | ||
view.setBankName(text: "Stripe Bank") | ||
view.setLastFourOfBank(text: "•••• 4242") | ||
view.setIncentiveEligible(false) | ||
|
||
verify(view) | ||
} | ||
|
||
private func verify( | ||
_ view: UIView, | ||
identifier: String? = nil, | ||
file: StaticString = #filePath, | ||
line: UInt = #line | ||
) { | ||
view.backgroundColor = .white | ||
view.autosizeHeight(width: 300) | ||
STPSnapshotVerifyView(view, identifier: identifier, file: file, line: line) | ||
} | ||
} |
Binary file added
BIN
+15.2 KB
...PaymentSheetTests.BankAccountInfoViewSnapshotTests/test_eligibleForPromo@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.3 KB
...ymentSheetTests.BankAccountInfoViewSnapshotTests/test_ineligibleForPromo@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.8 KB
...ripePaymentSheetTests.BankAccountInfoViewSnapshotTests/test_noPromoBadge@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.