Skip to content

Instantly share code, notes, and snippets.

@eyeezzi
Last active December 13, 2018 00:09
Show Gist options
  • Save eyeezzi/1ec7a130a123c2fe23ac1ae32e8e865e to your computer and use it in GitHub Desktop.
Save eyeezzi/1ec7a130a123c2fe23ac1ae32e8e865e to your computer and use it in GitHub Desktop.
Testing Views
import FBSnapshotTestCase
@testable import APP_TARGET
class UserCellTests: FBSnapshotTestCase {
func testNarrowCellWithLongName() {
let cell = createCell(name: Mock.longName, country: Mock.shortCountry, rank: Mock.shortRank, width: .iphone)
FBSnapshotVerifyView(cell)
}
func testNarrowCellWithLongCountryName() {
let cell = createCell(name: Mock.shortName, country: Mock.longCountry, rank: Mock.shortRank, width: .iphone)
FBSnapshotVerifyView(cell)
}
// private func createCell(name: String, country: String, rank: String, width: Width) -> UserCellView
}
extension UserCellTests {
private enum Width: CGFloat {
case iphone = 375
case ipad = 650
}
private enum Mock {
static let shortName = "Xu Xin"
static let longName = "Pablo Diego José Francisco de Paula Juan Nepomuceno"
static let shortRank = "13"
static let longRank = "6000"
static let shortCountry = "Canada"
static let longCountry = "Al Jumahiriyah al Arabiyah al Libiyah ash Shabiyah al Ishtirakiyah al Uzma"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment