@@ -603,6 +603,46 @@ describe('manage nsfs cli account flow', () => {
603603 const res = await exec_manage_cli ( type , action , account_options ) ;
604604 expect ( JSON . parse ( res . stdout ) . error . code ) . toBe ( ManageCLIError . InvalidSupplementalGroupsList . code ) ;
605605 } ) ;
606+
607+ it ( 'cli account add - with account name suffix `.json`' , async function ( ) {
608+ const action = ACTIONS . ADD ;
609+ const { type, new_buckets_path, uid, gid } = defaults ;
610+ await fs_utils . create_fresh_path ( new_buckets_path ) ;
611+ await fs_utils . file_must_exist ( new_buckets_path ) ;
612+ const name = 'account_suffix.json' ;
613+ const account_options = { config_root, name, new_buckets_path, uid, gid } ;
614+ const res = await exec_manage_cli ( type , action , account_options ) ;
615+ const parse_res = JSON . parse ( res ) ;
616+ expect ( parse_res . response . code ) . toEqual ( ManageCLIResponse . AccountCreated . code ) ;
617+ expect ( parse_res . response . reply . name ) . toEqual ( name ) ;
618+ const account = await config_fs . get_account_by_name ( name ) ;
619+ expect ( account . name ) . toBe ( name ) ;
620+ const res1 = await exec_manage_cli ( TYPES . ACCOUNT , ACTIONS . STATUS , { name, config_root } ) ;
621+ expect ( JSON . parse ( res1 ) . response . reply . name ) . toBe ( name ) ;
622+ const res_list = await exec_manage_cli ( TYPES . ACCOUNT , ACTIONS . LIST , { config_root } ) ;
623+ expect ( JSON . parse ( res_list ) . response . reply . map ( item => item . name ) )
624+ . toEqual ( expect . arrayContaining ( [ name ] ) ) ;
625+ } ) ;
626+
627+ it ( 'cli account add - with account name suffix `.symlink`' , async function ( ) {
628+ const action = ACTIONS . ADD ;
629+ const { type, new_buckets_path, uid, gid } = defaults ;
630+ await fs_utils . create_fresh_path ( new_buckets_path ) ;
631+ await fs_utils . file_must_exist ( new_buckets_path ) ;
632+ const name = 'account_suffix.symlink' ;
633+ const account_options = { config_root, name, new_buckets_path, uid, gid } ;
634+ const res = await exec_manage_cli ( type , action , account_options ) ;
635+ const parse_res = JSON . parse ( res ) ;
636+ expect ( parse_res . response . code ) . toEqual ( ManageCLIResponse . AccountCreated . code ) ;
637+ expect ( parse_res . response . reply . name ) . toEqual ( name ) ;
638+ const account = await config_fs . get_account_by_name ( name ) ;
639+ expect ( account . name ) . toBe ( name ) ;
640+ const res1 = await exec_manage_cli ( TYPES . ACCOUNT , ACTIONS . STATUS , { name, config_root } ) ;
641+ expect ( JSON . parse ( res1 ) . response . reply . name ) . toBe ( name ) ;
642+ const res_list = await exec_manage_cli ( TYPES . ACCOUNT , ACTIONS . LIST , { config_root } ) ;
643+ expect ( JSON . parse ( res_list ) . response . reply . map ( item => item . name ) )
644+ . toEqual ( expect . arrayContaining ( [ name ] ) ) ;
645+ } ) ;
606646 } ) ;
607647
608648 describe ( 'cli update account' , ( ) => {
0 commit comments