-
Notifications
You must be signed in to change notification settings - Fork 995
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test to catch zip code switching regressions in STPShippingAddre…
…ssViewController
- Loading branch information
1 parent
fe5b1aa
commit 70e2b83
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
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,73 @@ | ||
// | ||
// STPShippingAddressViewControllerTest.m | ||
// StripeiOS Tests | ||
// | ||
// Created by Cameron Sabol on 8/7/18. | ||
// Copyright © 2018 Stripe, Inc. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
#import <Stripe/Stripe.h> | ||
#import "NSLocale+STPSwizzling.h" | ||
#import "STPFixtures.h" | ||
|
||
@interface STPShippingAddressViewControllerTest : XCTestCase | ||
|
||
@end | ||
|
||
@implementation STPShippingAddressViewControllerTest | ||
|
||
- (void)testPrefilledBillingAddress_removeAddress { | ||
STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; | ||
config.requiredShippingAddressFields = [NSSet setWithObject:STPContactFieldPostalAddress]; | ||
|
||
STPAddress *address = [STPAddress new]; | ||
address.name = @"John Smith Doe"; | ||
address.phone = @"8885551212"; | ||
address.email = @"[email protected]"; | ||
address.line1 = @"55 John St"; | ||
address.city = @"Harare"; | ||
address.postalCode = @"10002"; | ||
address.country = @"ZW"; | ||
|
||
STPShippingAddressViewController *sut = [[STPShippingAddressViewController alloc] initWithConfiguration:config | ||
theme:[STPTheme defaultTheme] | ||
currency:nil | ||
shippingAddress:address | ||
selectedShippingMethod:nil | ||
prefilledInformation:nil]; | ||
|
||
[sut loadView]; | ||
[sut viewDidLoad]; | ||
} | ||
|
||
- (void)testPrefilledBillingAddress_addAddress { | ||
[NSLocale stp_setCurrentLocale:[NSLocale localeWithLocaleIdentifier:@"en_ZW"]]; | ||
STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; | ||
config.requiredShippingAddressFields = [NSSet setWithObject:STPContactFieldPostalAddress]; | ||
|
||
STPAddress *address = [STPAddress new]; | ||
address.name = @"John Smith Doe"; | ||
address.phone = @"8885551212"; | ||
address.email = @"[email protected]"; | ||
address.line1 = @"55 John St"; | ||
address.city = @"New York"; | ||
address.state = @"NY"; | ||
address.postalCode = @"10002"; | ||
address.country = @"US"; | ||
|
||
STPShippingAddressViewController *sut = [[STPShippingAddressViewController alloc] initWithConfiguration:config | ||
theme:[STPTheme defaultTheme] | ||
currency:nil | ||
shippingAddress:address | ||
selectedShippingMethod:nil | ||
prefilledInformation:nil]; | ||
|
||
[sut loadView]; | ||
[sut viewDidLoad]; | ||
[NSLocale stp_resetCurrentLocale]; | ||
} | ||
|
||
|
||
@end |