@@ -262,7 +262,7 @@ describe("db config store", () => {
262262 } ) ;
263263
264264 // Add
265- const response = await configStore . addRemoteReposToList (
265+ await configStore . addRemoteReposToList (
266266 [ "owner/repo1" , "owner/repo2" ] ,
267267 "list1" ,
268268 ) ;
@@ -278,72 +278,6 @@ describe("db config store", () => {
278278 name : "list1" ,
279279 repositories : [ "owner/repo1" , "owner/repo2" ] ,
280280 } ) ;
281- expect ( response ) . toEqual ( [ ] ) ;
282-
283- configStore . dispose ( ) ;
284- } ) ;
285-
286- it ( "should add no more than 1000 repositories to a remote list when adding multiple repos" , async ( ) => {
287- // Initial set up
288- const dbConfig = createDbConfig ( {
289- remoteLists : [
290- {
291- name : "list1" ,
292- repositories : [ ] ,
293- } ,
294- ] ,
295- } ) ;
296-
297- const configStore = await initializeConfig ( dbConfig , configPath , app ) ;
298-
299- // Add
300- const response = await configStore . addRemoteReposToList (
301- [ ...Array ( 1001 ) . keys ( ) ] . map ( ( i ) => `owner/db${ i } ` ) ,
302- "list1" ,
303- ) ;
304-
305- // Read the config file
306- const updatedDbConfig = ( await readJSON ( configPath ) ) as DbConfig ;
307-
308- // Check that the config file has been updated
309- const updatedRemoteDbs = updatedDbConfig . databases . variantAnalysis ;
310- expect ( updatedRemoteDbs . repositories ) . toHaveLength ( 0 ) ;
311- expect ( updatedRemoteDbs . repositoryLists ) . toHaveLength ( 1 ) ;
312- expect ( updatedRemoteDbs . repositoryLists [ 0 ] . repositories ) . toHaveLength (
313- 1000 ,
314- ) ;
315- expect ( response ) . toEqual ( [ "owner/db1000" ] ) ;
316-
317- configStore . dispose ( ) ;
318- } ) ;
319-
320- it ( "should add no more than 1000 repositories to a remote list when adding one repo" , async ( ) => {
321- // Initial set up
322- const dbConfig = createDbConfig ( {
323- remoteLists : [
324- {
325- name : "list1" ,
326- repositories : [ ...Array ( 1000 ) . keys ( ) ] . map ( ( i ) => `owner/db${ i } ` ) ,
327- } ,
328- ] ,
329- } ) ;
330-
331- const configStore = await initializeConfig ( dbConfig , configPath , app ) ;
332-
333- // Add
334- const reponse = await configStore . addRemoteRepo ( "owner/db1000" , "list1" ) ;
335-
336- // Read the config file
337- const updatedDbConfig = ( await readJSON ( configPath ) ) as DbConfig ;
338-
339- // Check that the config file has been updated
340- const updatedRemoteDbs = updatedDbConfig . databases . variantAnalysis ;
341- expect ( updatedRemoteDbs . repositories ) . toHaveLength ( 0 ) ;
342- expect ( updatedRemoteDbs . repositoryLists ) . toHaveLength ( 1 ) ;
343- expect ( updatedRemoteDbs . repositoryLists [ 0 ] . repositories ) . toHaveLength (
344- 1000 ,
345- ) ;
346- expect ( reponse ) . toEqual ( [ "owner/db1000" ] ) ;
347281
348282 configStore . dispose ( ) ;
349283 } ) ;
0 commit comments