@@ -18,6 +18,7 @@ import { expectError } from "../test/expect-utils";
1818import { UserService } from "../user/user-service" ;
1919import { DefaultWorkspaceImageValidator } from "./default-workspace-image-validator" ;
2020import { SYSTEM_USER } from "../authorization/authorizer" ;
21+ import { IDEService } from "../ide-service" ;
2122
2223const expect = chai . expect ;
2324
@@ -47,6 +48,36 @@ describe("OrganizationService", async () => {
4748 await validateDefaultWorkspaceImage ( userId , imageRef ) ;
4849 }
4950 } ) ;
51+ // Setup
52+ container . rebind < IDEService > ( IDEService ) . toConstantValue ( {
53+ getIDEConfig : async ( ) => ( {
54+ supervisorImage : "foo" ,
55+ ideOptions : {
56+ options : {
57+ code : {
58+ orderKey : "00" ,
59+ title : "VS Code" ,
60+ type : "browser" ,
61+ logo : "https://ide.gitpod.io/image/ide-logo/vscode.svg" ,
62+ label : "Browser" ,
63+ image : "bar" ,
64+ latestImage : "baz" ,
65+ versions : [ { version : "1.2.3" } ] ,
66+ } ,
67+ intellij : {
68+ orderKey : "01" ,
69+ title : "Intellij" ,
70+ type : "desktop" ,
71+ logo : "https://ide.gitpod.io/image/ide-logo/intellij.svg" ,
72+ label : "Desktop" ,
73+ image : "bar" ,
74+ latestImage : "baz" ,
75+ versions : [ { version : "4.5.6" } ] ,
76+ } ,
77+ } ,
78+ } ,
79+ } ) ,
80+ } as any as IDEService ) ;
5081 os = container . get ( OrganizationService ) ;
5182 userService = container . get < UserService > ( UserService ) ;
5283 owner = await userService . createUser ( {
@@ -519,6 +550,26 @@ describe("OrganizationService", async () => {
519550 const failingInvite = await orgService . getOrCreateInvite ( owner . id , anotherOrg . id ) ;
520551 await expectError ( ErrorCodes . PERMISSION_DENIED , ( ) => os . joinOrganization ( member . id , failingInvite . id ) ) ;
521552 } ) ;
553+
554+ it ( "should update pinnedEditorVersions" , async ( ) => {
555+ // Create a test organization
556+ const myOrg = await os . createOrganization ( adminId , "My Org" ) ;
557+
558+ // Test 1: Set specific pinned editor versions
559+ const pinnedVersions = { code : "1.2.3" , intellij : "4.5.6" } ;
560+ await os . updateSettings ( adminId , myOrg . id , { pinnedEditorVersions : pinnedVersions } ) ;
561+
562+ // Verify the settings were updated correctly
563+ let settings = await os . getSettings ( adminId , myOrg . id ) ;
564+ expect ( settings . pinnedEditorVersions ) . to . deep . equal ( pinnedVersions ) ;
565+
566+ // Test 2: Unset all pinned versions by setting an empty object
567+ await os . updateSettings ( adminId , myOrg . id , { pinnedEditorVersions : { } } ) ;
568+
569+ // Verify all pinned versions were removed
570+ settings = await os . getSettings ( adminId , myOrg . id ) ;
571+ expect ( settings . pinnedEditorVersions ) . to . deep . equal ( { } ) ;
572+ } ) ;
522573} ) ;
523574
524575async function createOrgOwnedUser ( os : OrganizationService , organizationId : string ) {
0 commit comments