Created
July 24, 2023 12:12
-
-
Save saroar/f40d7f3590fcf666f1f584aa349ca502 to your computer and use it in GitHub Desktop.
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
func testFillUpIsValidForm() async { | |
let store = TestStore( | |
initialState: GenericPassForm.State(vCard: .empty) | |
) { | |
GenericPassForm() | |
} withDependencies: { | |
$0.attachmentS3Client = .happyPath | |
} | |
await store.send(.set(\.$vCard.position, "CEO & IOS Developer")) { | |
$0.vCard.position = "CEO & IOS Developer" | |
} | |
await store.send(.set(\.$vCard.contact.firstName, "Jon")) { | |
$0.vCard.contact.firstName = "Jon" | |
} | |
await store.send(.set(\.$vCard.contact.lastName, "Don")) { | |
$0.vCard.contact.lastName = "Don" | |
} | |
let telephoneID = UUID() | |
await store.send(.set(\.$vCard.telephones, [.init(id: telephoneID,type: .work, number: "+79210000000")])) { | |
$0.vCard.telephones[0].id = telephoneID | |
$0.vCard.telephones[0].type = .work | |
$0.vCard.telephones[0].number = "+79210000000" | |
} | |
let emailID = UUID() | |
await store.send(.set(\.$vCard.emails, [.init(id: emailID, text: "[email protected]")])) { | |
$0.vCard.emails[0].id = emailID | |
$0.vCard.emails[0].text = "[email protected]" | |
} | |
let addressID = UUID() | |
await store.send( | |
.set( | |
\.$vCard.addresses, | |
[.init(id: addressID, type: .work, postOfficeAddress: nil, extendedAddress: nil, street: "Nevsky pr., 352, 182", locality: "Saint Petersburg", region: "Saint Petersburg", postalCode: "993153", country: "Russia")] | |
) | |
) { | |
$0.vCard.addresses[0].id = addressID | |
$0.vCard.addresses[0].street = "Nevsky pr., 352, 182" | |
$0.vCard.addresses[0].locality = "Saint Petersburg" | |
$0.vCard.addresses[0].region = "Saint Petersburg" | |
$0.vCard.addresses[0].postalCode = "993153" | |
$0.vCard.addresses[0].country = "Russia" | |
} | |
XCTAssertEqual(store.state.vCard.isVCardValid, true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment