Attempt to fix tests

This commit is contained in:
Carson Katri 2022-06-30 07:38:42 -04:00
parent 819b9cfa61
commit 510584cb15
2 changed files with 9 additions and 4 deletions

View File

@ -177,13 +177,18 @@ public struct TestFiberRenderer: FiberRenderer {
}
}
public final class WorkItemBox {
public var workItem: DispatchWorkItem?
}
/// The actively scheduled `DispatchWorkItem`
public static var workItem: DispatchWorkItem?
public var workItem: WorkItemBox = .init()
public func schedule(_ action: @escaping () -> ()) {
let workItem = DispatchWorkItem {
action()
}
DispatchQueue.global(qos: .default).async(execute: workItem)
Self.workItem = workItem
self.workItem.workItem = workItem
}
}

View File

@ -81,7 +81,7 @@ extension FiberReconciler where Renderer == TestFiberRenderer {
/// Wait for the scheduled action to complete.
func turnRunLoop() {
TestFiberRenderer.workItem?.wait()
TestFiberRenderer.workItem = nil
renderer.workItem.workItem?.wait()
renderer.workItem.workItem = nil
}
}