Skip to content

Commit

Permalink
Add UpdateTests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 24, 2024
1 parent 18bd387 commit e5f871f
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Tests/OpenSwiftUICoreTests/Data/UpdateTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// UpdateTests.swift
// OpenSwiftUICoreTests

import OpenSwiftUICore
import Testing

struct UpdateTests {
@Test
@MainActor
func example() async {
await confirmation(expectedCount: 4) { confirmation in
Update.locked {
confirmation()
#expect(!Update.isActive)
#expect(!Update.threadIsUpdating)
#expect(Update.isOwner)
Update.dispatchImmediately {
confirmation()
#expect(Update.isActive)
#expect(!Update.threadIsUpdating)
}
var result = 0
Update.enqueueAction {
confirmation()
result += 2
#expect(result == 2)
}
Update.enqueueAction {
confirmation()
result += 3
#expect(result == 5)
}
Update.dispatchActions()
#expect(result == 5)
}
}
}
}

0 comments on commit e5f871f

Please sign in to comment.