Skip to content

Commit

Permalink
Added one test case, fixed a small bug
Browse files Browse the repository at this point in the history
- Additional test case for @scope/module@tag
- Fixed a bug for checking the position of the last @ in the module name, that could trigger on -1.
  • Loading branch information
daankets committed Feb 8, 2018
1 parent 7158a9c commit ea6f3a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ var Utility = module.exports = {
}

//pm2 install @somescope/[email protected]
if(canonic_module_name.lastIndexOf('@') !== 0) {
if(canonic_module_name.lastIndexOf('@') > 0) {
canonic_module_name = canonic_module_name.substr(0,canonic_module_name.lastIndexOf("@"));
}

Expand Down
1 change: 1 addition & 0 deletions test/interface/utility.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Utility', function() {
assert(Utility.getCanonicModuleName('ma-zal/pm2-slack#own-branch') === 'pm2-slack');
assert(Utility.getCanonicModuleName('pm2-slack') === 'pm2-slack');
assert(Utility.getCanonicModuleName('@org/pm2-slack') === '@org/pm2-slack');
assert(Utility.getCanonicModuleName('@org/pm2-slack@latest') === '@org/pm2-slack');
assert(Utility.getCanonicModuleName('git+https://github.com/user/pm2-slack') === 'pm2-slack');
assert(Utility.getCanonicModuleName('git+https://github.com/user/pm2-slack.git') === 'pm2-slack');
assert(Utility.getCanonicModuleName('file:///home/user/pm2-slack') === 'pm2-slack');
Expand Down

0 comments on commit ea6f3a1

Please sign in to comment.