-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Testing] Adding a snapshot testing framework #165
Comments
I'm 👍 with adding any testing frameworks necessary for proper coverage as long as we keep things simple. Thanks for raising the issue @johnxnguyen |
Damn, so it turns out that swift snapshot testing has a minimum iOS deployment target of 10.0, where as Down is compiling for iOS 9. One workaround is to bump the minimum iOS version to 10.0 for the test target only. I think I'll do this unless you have any objections. |
Go for it 👍 Test target can be anything, it's just the built target we try and back support |
Closed via #177 |
Please help prevent duplicate requests before submitting a new one:
Feature Request
Is your feature request related to a problem? Please describe.
The problem I'm having whilst implementing the default styler is how to write clean and concise tests for various formatting scenarios (in particular nested lists). Using standard asserts against the attributed string is cumbersome, verbose, error prone and hard to read.
Describe the solution you'd like
Testing attributed strings is inherently visual and I would argue that snapshot testing is particularly suitable in this case. It would remove the need to inspect attributes which would lead to much cleaner tests. It would also allow us to test formatting of the same markdown string across various screen sizes.
Additionally, we could also use non visual snapshot tests to cover the
AttributedStringVisitor
s output, instead of asserting a long markdown string that contains unicode code points.I would propose to use swift snapshot testing but am of course open to other frameworks.
I think we should keep dependencies to an absolute minimum, but this dependency would only be added to the test target and I believe it would be of great benefit.
Describe alternatives you've considered
If adding a framework dependency is a no go, then the only alternative we have is to use standard asserts to check the values of attributes (over particular ranges) of an attributed string.
The text was updated successfully, but these errors were encountered: