Skip to content

Commit

Permalink
. d Add @mainactor to test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreid committed Jun 26, 2024
1 parent 38356ca commit 73acac9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ For example, here's a test verifying:
`sut` is the System Under Test in the test fixture. The Swift version uses a handy `verify` method.

```swift
@MainActor
func test_showAlert_alertShouldHaveTitle() {
let alertVerifier = AlertVerifier()

Expand Down Expand Up @@ -112,6 +113,7 @@ Go through the steps above to present your alert or action sheet. Then call
`executeAction (forButton:)` on your `AlertVerifier` with the button title. For example:

```swift
@MainActor
func test_executingActionForOKButton_shouldDoSomething() throws {
let alertVerifier = AlertVerifier()
sut.showAlert()
Expand Down Expand Up @@ -157,6 +159,7 @@ For example, here's a test verifying:
`sut` is the System Under Test in the test fixture. The Swift version uses a handy `verify` method.

```swift
@MainActor
func test_presentedVC_shouldHaveSpecialSettingHello() {
let presentationVerifier = PresentationVerifier()

Expand Down Expand Up @@ -239,6 +242,7 @@ For example, here's a test verifying that a particular view controller was dismi
`sut` is the System Under Test in the test fixture. The Swift version uses a handy `verify` method.

```swift
@MainActor
func test_dismissingVC() {
let dismissalVerifier = DismissalVerifier()

Expand Down Expand Up @@ -271,6 +275,7 @@ Create an expectation in your test case. Fulfill it in the verifier's `testCompl
Add a short wait at the start of the Assert phase.

```swift
@MainActor
func test_showAlertOnMainDispatchQueue_shouldDoSomething() {
let alertVerifier = AlertVerifier()
let expectation = self.expectation(description: "alert presented")
Expand All @@ -284,6 +289,7 @@ func test_showAlertOnMainDispatchQueue_shouldDoSomething() {
```

```swift
@MainActor
func test_presentViewControllerOnMainDispatchQueue_shouldDoSomething() {
let presentationVerifier = PresentationVerifier()
let expectation = self.expectation(description: "view controller presented")
Expand Down

0 comments on commit 73acac9

Please sign in to comment.