-
|
Hi! extension Container {
var db: Factory<MyType> {
self { MyType() }
.singleton
}
}@Suite(.container { $0.mock() })
struct xxxTests {}extension Container {
func mock() {
self.reset()
// self.db.reset()
// Scope.singleton.reset()
}
}Thanks a lot for your help. 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Container.shared.reset only resets container registrations, options, and caches. Has no effect on resolved singletons. Resetting db should clear db's registrations, options, and clear its entry in the singleton cache. Scope.singleton.reset() should zap a previously resolved singleton. I reran the tests on those, should work. If not, need a minimum project that illustrates error. |
Beta Was this translation helpful? Give feedback.
-
|
Yep, that's bad. Added a specific warning against that to the README Do not, however, import |
Beta Was this translation helpful? Give feedback.
The reason is that I imported FactoryKit into both the main target and the test target.
Once I removed it from the test target, it worked.
Thank you for your time.