Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save giovani-pereira-ifood/23ec8dc5ed236dd3018325c7fd654f92 to your computer and use it in GitHub Desktop.
Save giovani-pereira-ifood/23ec8dc5ed236dd3018325c7fd654f92 to your computer and use it in GitHub Desktop.
final class IconsDataTests: XCTestCase {
func test_icons_shouldHaveExpectedHash() {
guard recordMode == false else {
recordReferenceHashes()
return
}
let storedObjects = storage.toredIconsHashes() // [IconData]
Icon.allCases.forEach { icon in
let sut = storage.hash(for: icon)
guard let matchingData = storedObjects.first(where: { $0.name == icon.name }) else {
return XCTFail("Icon \"\(icon.name)\" has not been recorded yet. Run the tests on record mode to update.")
}
XCTAssertTrue(
matchingData.data == sut.data,
"Icon \"\(icon.name)\" has been changed. Check the icon font and if this change was made on purpose. If correct, update this icon data running with recordMode enabled"
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment