Last active
December 13, 2018 00:08
-
-
Save eyeezzi/bb67ec7472fff78361fa0b35229aa82b to your computer and use it in GitHub Desktop.
Testing ViewModels
This file contains hidden or 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
import Foundation | |
@testable import Shopify_POS | |
class CustomerEntryViewModelTests: XCTestCase { | |
var viewModel: CustomerEntryViewModel! | |
override func setUp() { | |
super.setUp() | |
viewModel = CustomerEntryViewModel(/* mock properties */) | |
} | |
func testTaxExemptIsFalseByDefault() { | |
XCTAssertFalse(viewModel.taxExempt) | |
} | |
func testIsValidReturnsFalseForInvalidPhone() { | |
viewModel.firstName = "First Name" | |
viewModel.phone = "9820" | |
XCTAssertFalse(viewModel.isValid) | |
viewModel.phone = "9028025170" | |
XCTAssertTrue(viewModel.isValid) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment