Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Sep 11, 2024
1 parent 92c6c7c commit 5459125
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions Tests/ComposableArchitectureTests/EffectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,29 @@ final class EffectTests: BaseTCATestCase {
}

func testConcatenateOneEffect() async {
let values = LockIsolated<[Int]>([])

let effect = Effect<Int>.concatenate(
.publisher { Just(1).delay(for: 1, scheduler: self.mainQueue) }
)

let task = Task {
for await n in effect.actions {
values.withValue { $0.append(n) }
await withMainSerialExecutor {
let values = LockIsolated<[Int]>([])

let effect = Effect<Int>.concatenate(
.publisher { Just(1).delay(for: 1, scheduler: self.mainQueue) }
)

let task = Task {
for await n in effect.actions {
values.withValue { $0.append(n) }
}
}

XCTAssertEqual(values.value, [])

await self.mainQueue.advance(by: 1)
XCTAssertEqual(values.value, [1])

await self.mainQueue.run()
XCTAssertEqual(values.value, [1])

await task.value
}

XCTAssertEqual(values.value, [])

await self.mainQueue.advance(by: 1)
XCTAssertEqual(values.value, [1])

await self.mainQueue.run()
XCTAssertEqual(values.value, [1])

await task.value
}

func testMerge() async {
Expand Down

0 comments on commit 5459125

Please sign in to comment.