diff options
author | Yash Singh <saiansh2525@gmail.com> | 2021-04-08 20:56:34 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-04-14 19:42:51 +0300 |
commit | f9b639eb6c504ded6cdd59e83e26a392bfe81e5d (patch) | |
tree | 997ad7d8ddb8e281128602795b137426a04112d0 /test | |
parent | 58914be753e769c534aecc64b5c1883d195cd6dd (diff) |
feat(bugs): fall back to email if provided
If a bugs url is not provided, but a `mailto` is, then that is used.
PR-URL: https://github.com/npm/cli/pull/3052
Credit: @Yash-Singh1
Close: #3052
Reviewed-by: @wraithgar
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/bugs.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/lib/bugs.js b/test/lib/bugs.js index 1cc6e06ee..e5b238ffc 100644 --- a/test/lib/bugs.js +++ b/test/lib/bugs.js @@ -31,6 +31,16 @@ const pacote = { version: '1.2.3', repository: { url: 'https://github.com/foo/repoobj' }, } + : spec === 'mailtest' ? { + name: 'mailtest', + version: '3.7.4', + bugs: { email: 'hello@example.com' }, + } + : spec === 'secondmailtest' ? { + name: 'secondmailtest', + version: '0.1.1', + bugs: { email: 'ABC432abc@a.b.example.net' }, + } : spec === '.' ? { name: 'thispkg', version: '1.2.3', @@ -59,7 +69,7 @@ t.test('usage', (t) => { t.end() }) -t.test('open bugs urls', t => { +t.test('open bugs urls & emails', t => { const expect = { nobugs: 'https://www.npmjs.com/package/nobugs', 'bugsobj-nourl': 'https://www.npmjs.com/package/bugsobj-nourl', @@ -67,6 +77,8 @@ t.test('open bugs urls', t => { bugsobj: 'https://bugzilla.localhost/bugsobj', repourl: 'https://github.com/foo/repourl/issues', repoobj: 'https://github.com/foo/repoobj/issues', + mailtest: 'mailto:hello@example.com', + secondmailtest: 'mailto:ABC432abc@a.b.example.net', '.': 'https://example.com', } const keys = Object.keys(expect) |