How to prevent app storage with defined store to leak among tests? #117
-
Hello, when define app storage like:
how to change suitename for tests to prevent failed - '@shared(.appStorage("areDevicesEmpty"))' was given a new store object for an existing suite name ("mySuite")? In your app storage example tests I found just one test on the bottom that did not answer this for me. Regards, David. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@jiledaa It is not valid to construct a store with a suite name like this. If you expand the warning it tells you how to address the problem: swift-sharing/Sources/Sharing/SharedKeys/AppStorageKey.swift Lines 271 to 284 in c9fd8da Let us know if you have any other questions! |
Beta Was this translation helpful? Give feedback.
-
Ah right, as I use one get instance, the tests stop leaking with this app storage shared. However, in tests I can see another weird behavior.
and:
❌ for
✅ this passes, but does make sense. |
Beta Was this translation helpful? Give feedback.
@jiledaa It is not valid to construct a store with a suite name like this. If you expand the warning it tells you how to address the problem:
swift-sharing/Sources/Sharing/SharedKeys/AppStorageKey.swift
Lines 271 to 284 in c9fd8da