Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2020-12-11 22:17:16 +0300
committerisaacs <i@izs.me>2020-12-18 23:02:27 +0300
commitcba3341dae4c92541049dc976e82e2ba19566e95 (patch)
tree58cd8ea6579879b285d92a7b5a211e3f7a9a799b /tap-snapshots
parent44d4331058c53909ada62470b23b2185102b2128 (diff)
fix: npm profile refactor
- Fixes using `--otp` config option in `npm profile enable-2fa` - Prevents trying to enable 2fa if no user is logged in - Setting email should not require password - Add `test/lib/profile.js` tests - Async/await `lib/profile.js` refactor and more - Fixes: https://github.com/npm/statusboard/issues/164 PR-URL: https://github.com/npm/cli/pull/2373 Credit: @ruyadorno Close: #2373 Reviewed-by: @isaacs
Diffstat (limited to 'tap-snapshots')
-rw-r--r--tap-snapshots/test-lib-profile.js-TAP.test.js90
1 files changed, 90 insertions, 0 deletions
diff --git a/tap-snapshots/test-lib-profile.js-TAP.test.js b/tap-snapshots/test-lib-profile.js-TAP.test.js
new file mode 100644
index 000000000..bb838ad92
--- /dev/null
+++ b/tap-snapshots/test-lib-profile.js-TAP.test.js
@@ -0,0 +1,90 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/profile.js TAP enable-2fa from token and set otp, retries on pending and verifies with qrcode > should output 2fa enablement success msgs 1`] = `
+Scan into your authenticator app:
+qrcode
+ Or enter code:
+12342FA successfully enabled. Below are your recovery codes, please print these out.You will need these to recover access to your account if you lose your authentication device. 123456 789101
+`
+
+exports[`test/lib/profile.js TAP profile get <key> --parseable > should output parseable result value 1`] = `
+foo
+`
+
+exports[`test/lib/profile.js TAP profile get multiple args --parseable > should output parseable profile value results 1`] = `
+foo foo@github.com (verified) https://github.com/npm
+`
+
+exports[`test/lib/profile.js TAP profile get multiple args comma separated > should output all keys 1`] = `
+foo foo@github.com (verified) https://github.com/npm
+`
+
+exports[`test/lib/profile.js TAP profile get multiple args default output > should output all keys 1`] = `
+foo foo@github.com (verified) https://github.com/npm
+`
+
+exports[`test/lib/profile.js TAP profile get no args --parseable > should output all profile info as parseable result 1`] = `
+tfa auth-and-writesname fooemail foo@github.comemail_verified truecreated 2015-02-26T01:26:37.384Zupdated 2020-08-12T16:19:35.326Zfullname Foo Barhomepage https://github.comfreenode foobartwitter https://twitter.com/npmjsgithub https://github.com/npm
+`
+
+exports[`test/lib/profile.js TAP profile get no args default output > should output table with contents 1`] = `
+name: foo
+email: foo@github.com (verified)
+two-factor auth: auth-and-writes
+fullname: Foo Bar
+homepage: https://github.com
+freenode: foobar
+twitter: https://twitter.com/npmjs
+github: https://github.com/npm
+created: 2015-02-26T01:26:37.384Z
+updated: 2020-08-12T16:19:35.326Z
+`
+
+exports[`test/lib/profile.js TAP profile get no args no tfa enabled > should output expected profile values 1`] = `
+name: foo
+email: foo@github.com (verified)
+two-factor auth: disabled
+fullname: Foo Bar
+homepage: https://github.com
+freenode: foobar
+twitter: https://twitter.com/npmjs
+github: https://github.com/npm
+created: 2015-02-26T01:26:37.384Z
+updated: 2020-08-12T16:19:35.326Z
+`
+
+exports[`test/lib/profile.js TAP profile get no args profile has cidr_whitelist item > should output table with contents 1`] = `
+name: foo
+email: foo@github.com (verified)
+two-factor auth: auth-and-writes
+fullname: Foo Bar
+homepage: https://github.com
+freenode: foobar
+twitter: https://twitter.com/npmjs
+github: https://github.com/npm
+created: 2015-02-26T01:26:37.384Z
+updated: 2020-08-12T16:19:35.326Z
+cidr_whitelist: 192.168.1.1
+`
+
+exports[`test/lib/profile.js TAP profile get no args unverified email > should output table with contents 1`] = `
+name: foo
+email: foo@github.com(unverified)
+two-factor auth: auth-and-writes
+fullname: Foo Bar
+homepage: https://github.com
+freenode: foobar
+twitter: https://twitter.com/npmjs
+github: https://github.com/npm
+created: 2015-02-26T01:26:37.384Z
+updated: 2020-08-12T16:19:35.326Z
+`
+
+exports[`test/lib/profile.js TAP profile set <key> <value> writable key --parseable > should output parseable set key success msg 1`] = `
+fullname Lorem Ipsum
+`