Skip to content

Commit

Permalink
Add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Sep 5, 2024
1 parent 64cf3e8 commit 87608bc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/ComposableArchitectureTests/ObservableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ final class ObservableTests: BaseTCATestCase {
XCTAssertEqual(state.children[0].count, 43)
}

func testCopyMutation_WithPerturbation() async {
var state = ParentState(children: [ChildState(count: 42)])
let countDidChange = self.expectation(description: "count.didChange")
var copy = state.children[0]
copy.count += 1

withPerceptionTracking {
_ = state.children[0].count
} onChange: {
countDidChange.fulfill()
}

state.children[0] = copy
state.children[0]._$willModify()

await self.fulfillment(of: [countDidChange], timeout: 0.1)
XCTAssertEqual(state.children[0].count, 43)
}

func testReplace() async {
XCTTODO("Ideally this would pass but we cannot detect this kind of mutation currently.")

Expand Down

0 comments on commit 87608bc

Please sign in to comment.