Skip to content

Commit 53577ab

Browse files
authored
Merge pull request #35 from gibachan/tutorial
Improve tutorial
2 parents 33fdfcb + bf19dc6 commit 53577ab

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Sources/Fakes/Fakes.docc/Guides/DependencyInjection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ final class GreetingForTimeOfDayTests: XCTestCase {
199199
}
200200
```
201201

202-
> Note: Annoyed at the setup and act repitition? Check out
202+
> Note: Annoyed at the setup and act repetition? Check out
203203
[Quick](https://github.com/Quick/Quick/)! It provides a simple DSL enabling
204204
powerful test simplifications.
205205

Sources/Fakes/Fakes.docc/Guides/VerifyingCallbacks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ that, because it now has logic in it, we have to [write tests for that logic](ht
216216
Otherwise, we have no idea if a test failure is caused by something
217217
in the production code, or something in `FakeDispatchQueue`.
218218

219-
Some tests that verify thet entire API for `FakeDispatchQueue` look like this:
219+
Some tests that verify the entire API for `FakeDispatchQueue` look like this:
220220

221221
```swift
222222
final class FakeDispatchQueueTests: XCTestCase {

Sources/Fakes/Fakes.docc/Tutorials/WritingFakes/RecipeService.tutorial

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
This is a protocol for a `URLSession`-like object that can make
1919
various network requests.
2020

21-
@Code(name: "NetworkInterface", file: "NetworkInterface-01.swift")
21+
@Code(name: "NetworkInterface.swift", file: "NetworkInterface-01.swift")
2222
}
2323

2424
@Step {
2525
Given this `NetworkInterface`, you might write `RecipeService`
2626
like so:
2727

28-
@Code(name: "RecipeService", file: "RecipeService-01.swift")
28+
@Code(name: "RecipeService.swift", file: "RecipeService-01.swift")
2929
}
3030

3131
@Step {
@@ -41,7 +41,7 @@
4141
<doc:DependencyInjection>) to your Subject. You decide to come up with this
4242
first attempt at `FakeNetworkInterface`.
4343

44-
@Code(name: "FakeNetworkInterface", file: "FakeNetworkInterface-01.swift")
44+
@Code(name: "FakeNetworkInterface.swift", file: "FakeNetworkInterface-01.swift")
4545
}
4646

4747
@Step {
@@ -50,14 +50,14 @@
5050
used. This is where ``Spy`` comes in. Let's rewrite `FakeNetworkInterface` using
5151
``Spy``.
5252

53-
@Code(name: "FakeNetworkInterface", file: "FakeNetworkInterface-02.swift")
53+
@Code(name: "FakeNetworkInterface.swift", file: "FakeNetworkInterface-02.swift")
5454
}
5555

5656
@Step {
5757
This is the start of everything we need to write tests for
5858
`RecipeService`, so let's do just that.
5959

60-
@Code(name: "RecipeServiceTests", file: "RecipeServiceTests-01.swift")
60+
@Code(name: "RecipeServiceTests.swift", file: "RecipeServiceTests-01.swift")
6161
}
6262
}
6363
}
@@ -74,15 +74,15 @@
7474
@Step {
7575
First, let's start with updating `NetworkInterface`.
7676

77-
@Code(name: "NetworkInterface", file: "NetworkInterface-02.swift")
77+
@Code(name: "NetworkInterface.swift", file: "NetworkInterface-02.swift")
7878
}
7979

8080
@Step {
8181
With the updated `NetworkInterface`, we also have to update
8282
`RecipeService` to handle these new errors. For our purposes,
8383
let's just rethrow the errors and not do anything.
8484

85-
@Code(name: "RecipeService", file: "RecipeService-02.swift")
85+
@Code(name: "RecipeService.swift", file: "RecipeService-02.swift")
8686
}
8787

8888
@Step {
@@ -94,7 +94,7 @@
9494
`ThrowingSpy` is less boilerplate, and therefore easier to
9595
understand, so we'll go with that.
9696

97-
@Code(name: "FakeNetworkInterface", file: "FakeNetworkInterface-03.swift")
97+
@Code(name: "FakeNetworkInterface.swift", file: "FakeNetworkInterface-03.swift")
9898
}
9999

100100
@Step {
@@ -104,7 +104,7 @@
104104
that we're not crashing on errors. A downstream object might
105105
take the error and present an alert with a retry option.
106106

107-
@Code(name: "RecipeServiceTests", file: "RecipeServiceTests-02.swift")
107+
@Code(name: "RecipeServiceTests.swift", file: "RecipeServiceTests-02.swift")
108108
}
109109
}
110110
}
@@ -125,15 +125,15 @@
125125
As with before, let's start with `NetworkInterface`, making use
126126
of Swift Concurrency for this.
127127

128-
@Code(name: "NetworkInterface", file: "NetworkInterface-03.swift")
128+
@Code(name: "NetworkInterface.swift", file: "NetworkInterface-03.swift")
129129
}
130130

131131
@Step {
132132
With the again-updated `NetworkInterface`, we once again have
133133
to update `RecipeService` to work with the asynchronous
134134
`NetworkInterface`.
135135

136-
@Code(name: "RecipeService", file: "RecipeService-03.swift")
136+
@Code(name: "RecipeService.swift", file: "RecipeService-03.swift")
137137
}
138138

139139
@Step {
@@ -146,14 +146,14 @@
146146
let's use the one that flattens the generics as much as
147147
possible: `ThrowingPendableSpy`.
148148

149-
@Code(name: "FakeNetworkInterface", file: "FakeNetworkInterface-04.swift")
149+
@Code(name: "FakeNetworkInterface.swift", file: "FakeNetworkInterface-04.swift")
150150
}
151151

152152
@Step {
153153
Finally, we need to update the tests to work with all these
154154
async calls.
155155

156-
@Code(name: "RecipeServiceTests", file: "RecipeServiceTests-03.swift")
156+
@Code(name: "RecipeServiceTests.swift", file: "RecipeServiceTests-03.swift")
157157
}
158158
}
159159
}

0 commit comments

Comments
 (0)