@@ -589,6 +589,50 @@ describe("db panel", () => {
589589 new Error ( "A list with the name 'my-list-1' already exists" ) ,
590590 ) ;
591591 } ) ;
592+
593+ it ( "should not allow adding a new remote db with empty name" , async ( ) => {
594+ const dbConfig = createDbConfig ( ) ;
595+
596+ await saveDbConfig ( dbConfig ) ;
597+
598+ await expect ( dbManager . addNewRemoteRepo ( "" ) ) . rejects . toThrow (
599+ new Error ( "Repository name cannot be empty" ) ,
600+ ) ;
601+ } ) ;
602+
603+ it ( "should not allow adding a remote db with duplicate name" , async ( ) => {
604+ const dbConfig = createDbConfig ( {
605+ remoteRepos : [ "owner1/repo1" ] ,
606+ } ) ;
607+
608+ await saveDbConfig ( dbConfig ) ;
609+
610+ await expect ( dbManager . addNewRemoteRepo ( "owner1/repo1" ) ) . rejects . toThrow (
611+ new Error ( "The repository 'owner1/repo1' already exists" ) ,
612+ ) ;
613+ } ) ;
614+
615+ it ( "should not allow adding a new remote owner with empty name" , async ( ) => {
616+ const dbConfig = createDbConfig ( ) ;
617+
618+ await saveDbConfig ( dbConfig ) ;
619+
620+ await expect ( dbManager . addNewRemoteOwner ( "" ) ) . rejects . toThrow (
621+ new Error ( "Owner name cannot be empty" ) ,
622+ ) ;
623+ } ) ;
624+
625+ it ( "should not allow adding a remote owner with duplicate name" , async ( ) => {
626+ const dbConfig = createDbConfig ( {
627+ remoteOwners : [ "owner1" ] ,
628+ } ) ;
629+
630+ await saveDbConfig ( dbConfig ) ;
631+
632+ await expect ( dbManager . addNewRemoteOwner ( "owner1" ) ) . rejects . toThrow (
633+ new Error ( "The owner 'owner1' already exists" ) ,
634+ ) ;
635+ } ) ;
592636 } ) ;
593637
594638 async function saveDbConfig ( dbConfig : DbConfig ) : Promise < void > {
0 commit comments