Skip to content

[Office Hours] is there a way to mock dates in unit tests? #97

Discussion options

You must be logged in to vote

Hi @ChenaLee,

Good question!
Here are multiple great dependency injection frameworks out there that you can use to simplify your testing setup. Pointfree has a gerat library that you can use (swift-dependencies).

Factory and Swinject are also great options.

For simpler elements you might also want to use simple default values or injecting elements in initializers if necessary or follow articles such as the ones that @vishnuravi has linked.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ChenaLee
Comment options

@PSchmiedmayer
Comment options

Answer selected by PSchmiedmayer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants