Skip to content

Commit d13751d

Browse files
freak4pckzaher
authored andcommitted
Some minor updates to UnitTests.md introducing the materialize() operator
1 parent 5724db0 commit d13751d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Documentation/UnitTests.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ It's easy to define `RxTests` extensions so you can write your tests in a readab
8686

8787
It is also possible to write integration tests by using `RxBlocking` operators.
8888

89-
Importing operators from `RxBlocking` library will enable blocking the current thread and wait for sequence results.
89+
Importing operators from the `RxBlocking` library will enable blocking the current thread and wait for sequence results.
9090

91-
If the squence succeeds, you can extract the array of results using `toArray()`, or `throw` if there's an error.
91+
A simple way to test the result of your sequence is using the `toArray` method. It will return an array of all elements emitted once a sequence has completed successfully, or `throw` if an error caused the sequence to terminate.
9292

9393
```swift
9494
let result = try fetchResource(location)
@@ -98,7 +98,7 @@ let result = try fetchResource(location)
9898
XCTAssertEqual(result, expectedResult)
9999
```
100100

101-
To extract a result representing the array of results _and_ an error if it occurred, the `materialize()` extension can be used.
101+
Another option is to use the `materialize` operator which allows you to more granularly examine your sequence. It will return a `MaterializedSequenceResult` enumeration that could be either `.completed` along with the emitted elements if the sequence completed successfully, or `failed` if the sequence terminated with an error, along with the emitted error.
102102

103103
```swift
104104
let result = try fetchResource(location)

0 commit comments

Comments
 (0)