File tree Expand file tree Collapse file tree 2 files changed +4
-19
lines changed
Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ export async function getProject(project = {}) {
4848 * @returns {Promise<Object[]> } The project configurations
4949 */
5050export async function getProjects ( ) {
51- return Promise . all ( ( await getConfig ( 'sync' , 'projects' )
52- || await getConfig ( 'sync' , 'hlxSidekickProjects' ) || [ ] ) // legacy
53- . map ( ( handle ) => getProject ( handle ) ) ) ;
51+ const configs = await getConfig ( 'sync' , 'projects' ) || [ ] ;
52+ const projects = await Promise . all ( configs . map ( ( handle ) => getProject ( handle ) ) ) ;
53+ return projects . filter ( ( project ) => project !== undefined ) ;
5454}
5555
5656/**
@@ -353,8 +353,7 @@ export async function deleteProject(project) {
353353 ( { owner, repo } = project ) ;
354354 handle = `${ owner } /${ repo } ` ;
355355 }
356- const projects = await getConfig ( 'sync' , 'projects' )
357- || await getConfig ( 'sync' , 'hlxSidekickProjects' ) || [ ] ; // legacy
356+ const projects = await getConfig ( 'sync' , 'projects' ) || [ ] ;
358357 const i = projects . indexOf ( handle ) ;
359358 if ( i >= 0 ) {
360359 // delete admin auth header rule
Original file line number Diff line number Diff line change @@ -132,7 +132,6 @@ describe('Test project', () => {
132132 let value ;
133133 switch ( prop ) {
134134 case 'projects' :
135- case 'hlxSidekickProjects' : // legacy
136135 value = [ 'foo/bar1' ] ;
137136 break ;
138137 case 'foo/bar1' :
@@ -155,22 +154,9 @@ describe('Test project', () => {
155154 sandbox . restore ( ) ;
156155 sandbox . stub ( chrome . storage . sync , 'get' )
157156 . withArgs ( 'projects' )
158- . resolves ( { } )
159- . withArgs ( 'hlxSidekickProjects' )
160157 . resolves ( { } ) ;
161158 projects = await getProjects ( ) ;
162159 expect ( projects . length ) . to . equal ( 0 ) ;
163- // legacy projects
164- sandbox . restore ( ) ;
165- sandbox . stub ( chrome . storage . sync , 'get' )
166- . withArgs ( 'projects' )
167- . resolves ( { } )
168- . withArgs ( 'hlxSidekickProjects' )
169- . resolves ( {
170- hlxSidekickProjects : [ 'foo/bar1' ] ,
171- } ) ;
172- projects = await getProjects ( ) ;
173- expect ( projects . length ) . to . equal ( 1 ) ;
174160 } ) ;
175161
176162 it ( 'getProjectEnv' , async ( ) => {
You can’t perform that action at this time.
0 commit comments