-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[server] move workspace ide configuration to ide service
Co-authored-by: Pudong Zheng <[email protected]> Co-authored-by: Victor Nogueira <[email protected]> Co-authored-by: Andrea Falzetti <[email protected]>
- Loading branch information
1 parent
a5d6744
commit 4effd6d
Showing
4 changed files
with
447 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
/** | ||
* Copyright (c) 2020 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { User } from "@gitpod/gitpod-protocol"; | ||
import * as chai from "chai"; | ||
import { IDEService } from "./ide-service"; | ||
const expect = chai.expect; | ||
|
||
describe("ide-service", function () { | ||
describe("migrateSettings", function () { | ||
const ideService = new IDEService(); | ||
it("with no ideSettings should be undefined", function () { | ||
const user: User = { | ||
id: "string", | ||
|
||
creationDate: "string", | ||
identities: [], | ||
additionalData: {}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result).to.undefined; | ||
}); | ||
|
||
it("with settingVersion 2.0 should be undefined", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
settingVersion: "2.0", | ||
defaultIde: "code-latest", | ||
useDesktopIde: false, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result).to.undefined; | ||
}); | ||
|
||
it("with code-latest should be code latest", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code-latest", | ||
useDesktopIde: false, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("code"); | ||
expect(result?.useLatestVersion ?? false).to.be.true; | ||
}); | ||
|
||
it("with code-desktop-insiders should be code-desktop latest", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code", | ||
defaultDesktopIde: "code-desktop-insiders", | ||
useDesktopIde: true, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("code-desktop"); | ||
expect(result?.useLatestVersion ?? false).to.be.true; | ||
}); | ||
|
||
it("with code-desktop should be code-desktop", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code", | ||
defaultDesktopIde: "code-desktop", | ||
useDesktopIde: true, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("code-desktop"); | ||
expect(result?.useLatestVersion ?? false).to.be.false; | ||
}); | ||
|
||
it("with intellij should be intellij", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code", | ||
defaultDesktopIde: "intellij", | ||
useLatestVersion: false, | ||
useDesktopIde: true, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("intellij"); | ||
expect(result?.useLatestVersion ?? false).to.be.false; | ||
}); | ||
|
||
it("with intellij latest version should be intellij latest", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code", | ||
defaultDesktopIde: "intellij", | ||
useLatestVersion: true, | ||
useDesktopIde: true, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("intellij"); | ||
expect(result?.useLatestVersion ?? false).to.be.true; | ||
}); | ||
|
||
it("with user desktopIde false should be code latest", function () { | ||
const user: User = { | ||
id: "string", | ||
creationDate: "string", | ||
identities: [], | ||
additionalData: { | ||
ideSettings: { | ||
defaultIde: "code-latest", | ||
defaultDesktopIde: "intellij", | ||
useLatestVersion: false, | ||
useDesktopIde: false, | ||
}, | ||
}, | ||
}; | ||
const result = ideService.migrateSettings(user); | ||
expect(result?.defaultIde).to.equal("code"); | ||
expect(result?.useLatestVersion ?? false).to.be.true; | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.