|
5 | 5 | */
|
6 | 6 |
|
7 | 7 | import { User } from "@gitpod/gitpod-protocol";
|
8 |
| -import { IDEOption, IDEOptions } from "@gitpod/gitpod-protocol/lib/ide-protocol"; |
9 | 8 | import * as chai from "chai";
|
10 |
| -import { migrationIDESettings, chooseIDE } from "./workspace-starter"; |
| 9 | +import { migrationIDESettings } from "./workspace-starter"; |
11 | 10 | const expect = chai.expect;
|
12 | 11 |
|
13 | 12 | describe("workspace-starter", function () {
|
@@ -150,118 +149,4 @@ describe("workspace-starter", function () {
|
150 | 149 | expect(result?.useLatestVersion ?? false).to.be.true;
|
151 | 150 | });
|
152 | 151 | });
|
153 |
| - describe("chooseIDE", async function () { |
154 |
| - const baseOpt: IDEOption = { |
155 |
| - title: "title", |
156 |
| - type: "desktop", |
157 |
| - logo: "", |
158 |
| - image: "image", |
159 |
| - latestImage: "latestImage", |
160 |
| - }; |
161 |
| - const ideOptions: IDEOptions = { |
162 |
| - options: { |
163 |
| - code: Object.assign({}, baseOpt, { type: "browser" }), |
164 |
| - goland: Object.assign({}, baseOpt), |
165 |
| - "code-desktop": Object.assign({}, baseOpt), |
166 |
| - "no-latest": Object.assign({}, baseOpt), |
167 |
| - }, |
168 |
| - defaultIde: "code", |
169 |
| - defaultDesktopIde: "code-desktop", |
170 |
| - }; |
171 |
| - delete ideOptions.options["no-latest"].latestImage; |
172 |
| - |
173 |
| - it("code with latest", function () { |
174 |
| - const useLatest = true; |
175 |
| - const hasPerm = false; |
176 |
| - const result = chooseIDE("code", ideOptions, useLatest, hasPerm); |
177 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
178 |
| - }); |
179 |
| - |
180 |
| - it("code without latest", function () { |
181 |
| - const useLatest = false; |
182 |
| - const hasPerm = false; |
183 |
| - const result = chooseIDE("code", ideOptions, useLatest, hasPerm); |
184 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].image); |
185 |
| - }); |
186 |
| - |
187 |
| - it("desktop ide with latest", function () { |
188 |
| - const useLatest = true; |
189 |
| - const hasPerm = false; |
190 |
| - const result = chooseIDE("code-desktop", ideOptions, useLatest, hasPerm); |
191 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
192 |
| - expect(result.desktopIdeImage).to.equal(ideOptions.options["code-desktop"].latestImage); |
193 |
| - }); |
194 |
| - |
195 |
| - it("desktop ide (JetBrains) without latest", function () { |
196 |
| - const useLatest = false; |
197 |
| - const hasPerm = false; |
198 |
| - const result = chooseIDE("goland", ideOptions, useLatest, hasPerm); |
199 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].image); |
200 |
| - expect(result.desktopIdeImage).to.equal(ideOptions.options["goland"].image); |
201 |
| - }); |
202 |
| - |
203 |
| - it("desktop ide with no latest image", function () { |
204 |
| - const useLatest = true; |
205 |
| - const hasPerm = false; |
206 |
| - const result = chooseIDE("no-latest", ideOptions, useLatest, hasPerm); |
207 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
208 |
| - expect(result.desktopIdeImage).to.equal(ideOptions.options["no-latest"].image); |
209 |
| - }); |
210 |
| - |
211 |
| - it("unknown ide with custom permission should be unknown", function () { |
212 |
| - const customOptions = Object.assign({}, ideOptions); |
213 |
| - customOptions.options["unknown-custom"] = { |
214 |
| - title: "unknown title", |
215 |
| - type: "browser", |
216 |
| - logo: "", |
217 |
| - image: "", |
218 |
| - }; |
219 |
| - const useLatest = true; |
220 |
| - const hasPerm = true; |
221 |
| - const result = chooseIDE("unknown-custom", customOptions, useLatest, hasPerm); |
222 |
| - expect(result.ideImage).to.equal("unknown-custom"); |
223 |
| - }); |
224 |
| - |
225 |
| - it("unknown desktop ide with custom permission desktop should be unknown", function () { |
226 |
| - const customOptions = Object.assign({}, ideOptions); |
227 |
| - customOptions.options["unknown-custom"] = { |
228 |
| - title: "unknown title", |
229 |
| - type: "desktop", |
230 |
| - logo: "", |
231 |
| - image: "", |
232 |
| - }; |
233 |
| - const useLatest = true; |
234 |
| - const hasPerm = true; |
235 |
| - const result = chooseIDE("unknown-custom", customOptions, useLatest, hasPerm); |
236 |
| - expect(result.desktopIdeImage).to.equal("unknown-custom"); |
237 |
| - }); |
238 |
| - |
239 |
| - it("unknown browser ide without custom permission should fallback to code", function () { |
240 |
| - const customOptions = Object.assign({}, ideOptions); |
241 |
| - customOptions.options["unknown-custom"] = { |
242 |
| - title: "unknown title", |
243 |
| - type: "browser", |
244 |
| - logo: "", |
245 |
| - image: "", |
246 |
| - }; |
247 |
| - const useLatest = true; |
248 |
| - const hasPerm = false; |
249 |
| - const result = chooseIDE("unknown-custom", customOptions, useLatest, hasPerm); |
250 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
251 |
| - }); |
252 |
| - |
253 |
| - it("not exists ide with custom permission", function () { |
254 |
| - const useLatest = true; |
255 |
| - const hasPerm = true; |
256 |
| - const result = chooseIDE("not-exists", ideOptions, useLatest, hasPerm); |
257 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
258 |
| - }); |
259 |
| - |
260 |
| - it("not exists ide with custom permission", function () { |
261 |
| - const useLatest = true; |
262 |
| - const hasPerm = false; |
263 |
| - const result = chooseIDE("not-exists", ideOptions, useLatest, hasPerm); |
264 |
| - expect(result.ideImage).to.equal(ideOptions.options["code"].latestImage); |
265 |
| - }); |
266 |
| - }); |
267 | 152 | });
|
0 commit comments