File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ import * as open from 'open';
1111export const getAliasByUsername = async ( username : string ) : Promise < string > => {
1212 const alias = await Aliases . create ( Aliases . getDefaultOptions ( ) ) ;
1313 const keys = alias . getKeysByValue ( username ) ;
14- return keys ?. length ? keys [ 0 ] : undefined ;
14+ // use the most recently added alias for that username
15+ return keys ?. length ? keys [ keys . length - 1 ] : undefined ;
1516} ;
1617
1718export const openUrl = async ( url : string ) : Promise < ChildProcess > => {
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ describe('getAliasByUsername', () => {
2727 expect ( await getAliasByUsername ( 'username1' ) ) . to . equal ( 'alias1' ) ;
2828 } ) ;
2929
30- it ( 'returns first alias for a username that has multiple aliases' , async ( ) => {
31- expect ( await getAliasByUsername ( 'username2' ) ) . to . equal ( 'alias2 ' ) ;
30+ it ( 'returns most recent alias for a username that has multiple aliases' , async ( ) => {
31+ expect ( await getAliasByUsername ( 'username2' ) ) . to . equal ( 'alias2b ' ) ;
3232 } ) ;
3333
3434 it ( 'returns undefined when no matching username is found' , async ( ) => {
You can’t perform that action at this time.
0 commit comments