mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
22d14ff8e4
* create DependenciesProtocol and replace ServiceLocator registration with it replace mocking calls for ServiceLocator to Dependencies replace ServiceLocator with instance level calls replace ServiceLocator configs with TestDependencies config in Tests replace servicelocator usage in analytics service replace remaining ServiceLocator calls in unit tests that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances fix swiftlint warning remove remaining references to ServiceLocator make dependencies properties consistent in tests delete Dependencies and DependenciesProtocol fix whitespace modifications updates from PR feedback a pass over converting AppSettings and AnalyticsService test instance properties to per test instantiation fix a missed PR feedback Sync up after rebase create DependenciesProtocol and replace ServiceLocator registration with it replace mocking calls for ServiceLocator to Dependencies replace ServiceLocator with instance level calls replace ServiceLocator configs with TestDependencies config in Tests replace servicelocator usage in analytics service replace remaining ServiceLocator calls in unit tests that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances fix swiftlint warning remove remaining references to ServiceLocator make dependencies properties consistent in tests delete Dependencies and DependenciesProtocol * AppSettings is instance level mockable now * replace mocked and preview usages of reset + AppSettings global init with AppSettings(store: UserDefaultsMock()) * AppSettings.UserDefaultsKeys is now a RawRep struct, making it extensible * update tests with new AppSettings so it builds * update remaining AppSettings test/mock inits * AppSettings.UserDefaultsKey conformed to ExpressibleByStringLiteral * addressed issues found in first pass ai review * update AppSettings instantiations after rebase * fix accessibility tests coordinator after rebase * Rename to VolatileUserDefaults * AppSettings init uses mandatory parameter * Revert UserDefaultsKey to enum * Add TrackedUserDefaults to be able to reset the defaults object * Added volatile static func to AppSettings * Use .volatile() static func instead of full init * review fixups * Resolve build issues after rebase * updated enterprise module * remove the static reset settings call from the preview tests --------- Co-authored-by: Mauro Romito <mauro.romito@element.io>
48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
// swiftlint:disable all
|
|
// swiftformat:disable all
|
|
|
|
import Testing
|
|
@testable import ElementX
|
|
{% if argument.mainTarget %}
|
|
@testable import {{ argument.mainTarget }}
|
|
{% endif %}
|
|
{% for import in argument.imports %}
|
|
{% if import != "last" %}
|
|
import {{ import }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for import in argument.testableImports %}
|
|
{% if import != "last" %}
|
|
@testable import {{ import }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
extension PreviewTests {
|
|
{% if argument.file %}
|
|
|
|
private var file: StaticString { .init(stringLiteral: "{{ argument.file }}") }
|
|
{% endif %}
|
|
|
|
// MARK: - PreviewProvider
|
|
|
|
{% for type in types.types where (type.implements.TestablePreview or type.based.TestablePreview or type|annotated:"TestablePreview") and type.name != "TestablePreview" %}
|
|
@Test
|
|
func {{ type.name|replace:"_Previews", ""| lowerFirstLetter }}() async throws {
|
|
for (index, preview) in {{ type.name }}._allPreviews.enumerated() {
|
|
try await assertSnapshots(matching: preview, step: index)
|
|
}
|
|
}
|
|
{%- if not forloop.last %}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if argument.previewsMacros %}
|
|
// MARK: - Macros
|
|
|
|
{{ argument.previewsMacros }}
|
|
{% endif %}
|
|
}
|
|
|
|
// swiftlint:enable all
|
|
// swiftformat:enable all
|