Skip to content

How to initialize database dependency for unit tests #134

Answered by mbrandonw
mplorentz asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mplorentz, I'm not super familiar with the specifics of CoreData anymore, but there's no need to use withDependencies in each individual test method. You can do it once for all tests in a class by overriding invokeTest. We have some docs here:

Sometimes there is a dependency that you want to override in a particular way for the entire test
case. For example, your feature may make extensive use of the ``DependencyValues/date`` dependency
and it may be cumbersome to override it in every test. Instead, it can be done a single time by
overrid…

Replies: 1 comment 2 replies

Comment options

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

@acosmicflamingo
Comment options

Answer selected by mplorentz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants