mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00

* Retrofit `deferFulfillment` onto snapshot tests. * Convert a bunch of preview tests to the new fulfillment publisher * Convert more tests * Remove unneeded delays from the remaining tests * Remove snapshotting delay option.
47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
// swiftlint:disable all
|
|
// swiftformat:disable all
|
|
|
|
import XCTest
|
|
@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" %}
|
|
func test_{{ type.name|lowerFirstLetter|replace:"_Previews", "" }}() async throws {
|
|
for preview in {{ type.name }}._allPreviews {
|
|
try await assertSnapshots(matching: preview)
|
|
}
|
|
}
|
|
{%- if not forloop.last %}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if argument.previewsMacros %}
|
|
// MARK: - Macros
|
|
|
|
{{ argument.previewsMacros }}
|
|
{% endif %}
|
|
}
|
|
|
|
// swiftlint:enable all
|
|
// swiftformat:enable all
|