| @@ -171,6 +171,34 @@ describe("settings scope resolution", () => { · 170 unmodified lines |
| 171 | }); | 171 | }); |
| 172 | }); | 172 | }); |
| 173 | | 173 | |
| | 174 | it("leaves a removed checkout unavailable while sibling checkouts remain", () => { |
| | 175 | const search = { |
| | 176 | project: "t3code", |
| | 177 | machine: laptopId, |
| | 178 | checkout: first.physicalProjectKey, |
| | 179 | }; |
| | 180 | expect(resolveSettingsScope(search, groups, environments)).toMatchObject({ |
| | 181 | kind: "checkout", |
| | 182 | members: [first], |
| | 183 | }); |
| | 184 | expect( |
| | 185 | resolveSettingsScope(search, [group("t3code", [second, third])], environments), |
| | 186 | ).toMatchObject({ kind: "unavailable", members: [], environmentIds: [] }); |
| | 187 | }); |
| | 188 | |
| | 189 | it("does not select another environment after removing a project's last local checkout", () => { |
| | 190 | const search = { project: "t3code", machine: laptopId }; |
| | 191 | expect(resolveSettingsScope(search, groups, environments)).toMatchObject({ |
| | 192 | kind: "project", |
| | 193 | members: [first, second], |
| | 194 | }); |
| | 195 | expect(resolveSettingsScope(search, [group("t3code", [third])], environments)).toMatchObject({ |
| | 196 | kind: "unavailable", |
| | 197 | members: [], |
| | 198 | environmentIds: [], |
| | 199 | }); |
| | 200 | }); |
| | 201 | |
| 174 | it("rejects a cached checkout whose environment was removed", () => { | 202 | it("rejects a cached checkout whose environment was removed", () => { |
| 175 | expect( | 203 | expect( |
| 176 | resolveSettingsScope( | 204 | resolveSettingsScope( |