Commit d9d1f94513
Unsigned
Layout: unified · split
gitbayTests/MRLifecycleTests.swift +11 −10
| @@ -121,9 +121,10 @@ struct MRLifecycleActionTests { | ||
| 121 | 121 | """)) |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | /// `load()` issues three GETs: `mr show`, `mr diff`, `mr threads`. | |
| 125 | /// `loaded()` runs it once (3 GETs, the last two unstubbed and failed), | |
| 126 | /// so a reload after a write brings the total to 6. | |
| 124 | /// `load()` issues four GETs: `mr show`, `mr diff`, `mr threads`, | |
| 125 | /// `mr revisions`. `loaded()` runs it once (4 GETs, the last three | |
| 126 | /// unstubbed and failed), so a reload after a write brings the total | |
| 127 | /// to 8. | |
| 127 | 128 | private func gets(_ box: StubProtocol.Box) -> Int { |
| 128 | 129 | box.seen.count { $0.method == "GET" } |
| 129 | 130 | } |
| @@ -134,14 +135,14 @@ struct MRLifecycleActionTests { | ||
| 134 | 135 | await model.setDraft(true) |
| 135 | 136 | var write = try #require(box.seen.first { $0.method == "POST" }) |
| 136 | 137 | #expect(try argvOf(write) == ["mr", "draft", "krz/gitbay", "7"]) |
| 137 | #expect(gets(box) == 6) | |
| 138 | #expect(gets(box) == 8) | |
| 138 | 139 | |
| 139 | 140 | let (model2, box2) = try await loaded() |
| 140 | 141 | ok(box2) |
| 141 | 142 | await model2.setDraft(false) |
| 142 | 143 | write = try #require(box2.seen.first { $0.method == "POST" }) |
| 143 | 144 | #expect(try argvOf(write) == ["mr", "ready", "krz/gitbay", "7"]) |
| 144 | #expect(gets(box2) == 6) | |
| 145 | #expect(gets(box2) == 8) | |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | @Test func retargetPassesTheBranchPositionally() async throws { |
| @@ -150,7 +151,7 @@ struct MRLifecycleActionTests { | ||
| 150 | 151 | await model.retarget(to: "release") |
| 151 | 152 | let write = try #require(box.seen.first { $0.method == "POST" }) |
| 152 | 153 | #expect(try argvOf(write) == ["mr", "retarget", "krz/gitbay", "7", "release"]) |
| 153 | #expect(gets(box) == 6) | |
| 154 | #expect(gets(box) == 8) | |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | 157 | /// `mr review request` is a THREE-word path. Two words posts a |
| @@ -162,7 +163,7 @@ struct MRLifecycleActionTests { | ||
| 162 | 163 | let write = try #require(box.seen.first { $0.method == "POST" }) |
| 163 | 164 | #expect(try argvOf(write) |
| 164 | 165 | == ["mr", "review", "request", "krz/gitbay", "7", "--add", "rae"]) |
| 165 | #expect(gets(box) == 6) | |
| 166 | #expect(gets(box) == 8) | |
| 166 | 167 | } |
| 167 | 168 | |
| 168 | 169 | @Test func removingAReviewRequestUsesRemoveNotAdd() async throws { |
| @@ -172,7 +173,7 @@ struct MRLifecycleActionTests { | ||
| 172 | 173 | let write = try #require(box.seen.first { $0.method == "POST" }) |
| 173 | 174 | #expect(try argvOf(write) |
| 174 | 175 | == ["mr", "review", "request", "krz/gitbay", "7", "--remove", "rae"]) |
| 175 | #expect(gets(box) == 6) | |
| 176 | #expect(gets(box) == 8) | |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | @Test func branchesComeFromRepoRefs() async throws { |
| @@ -195,8 +196,8 @@ struct MRLifecycleActionTests { | ||
| 195 | 196 | #expect(model.actionError?.isEmpty == false) |
| 196 | 197 | #expect(model.working == false) |
| 197 | 198 | // A refusal throws before `perform` reaches `load()`: still the |
| 198 | // 3 GETs from `loaded()`, none from a reload. | |
| 199 | #expect(gets(box) == 3) | |
| 199 | // 4 GETs from `loaded()`, none from a reload. | |
| 200 | #expect(gets(box) == 4) | |
| 200 | 201 | } |
| 201 | 202 | } |
| 202 | 203 | |