Skip to content

Commit

Permalink
Update usage of XCTRuntimePrecondition
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Jul 15, 2024
1 parent 5e22e62 commit 8c8cf1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ final class ModuleCommunicationTests: XCTestCase {
func testIllegalAccess() throws {
let delegate = TestApplicationDelegate()

try XCTRuntimePrecondition {
try XCTRuntimePrecondition { @MainActor in
try? await Task.sleep(for: .milliseconds(0))
_ = Self.collectModule.strings
}

_ = delegate.spezi // ensure init

try XCTRuntimePrecondition {
try XCTRuntimePrecondition { @MainActor in
try? await Task.sleep(for: .milliseconds(0))
Self.provideModule.numMaybe2 = 12
}
}
Expand Down
3 changes: 2 additions & 1 deletion Tests/SpeziTests/ModuleTests/ModuleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ final class ModuleTests: XCTestCase {

@MainActor
func testPreviewModifierOnlyWithinPreview() throws {
try XCTRuntimePrecondition {
try XCTRuntimePrecondition { @MainActor in
try? await Task.sleep(for: .milliseconds(0))
_ = Text("Spezi")
.previewWith {
TestModule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class StandardUnfulfilledConstraintTests: XCTestCase {
func testStandardUnfulfilledConstraint() throws {
let standardCUTestApplicationDelegate = StandardUCTestApplicationDelegate()
try XCTRuntimePrecondition(timeout: 0.5) {
_ = standardCUTestApplicationDelegate.spezi
_ = await standardCUTestApplicationDelegate.spezi
}
}
}

0 comments on commit 8c8cf1e

Please sign in to comment.