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:
authornlf <quitlahok@gmail.com>2020-10-05 19:47:15 +0300
committernlf <quitlahok@gmail.com>2020-10-05 19:47:15 +0300
commit2db6f1d2ece9af692d57727d5a25f64d30ffc092 (patch)
tree05db971992144cc9649ed5de32e5a85c419900e9
parentd48086d0d3e006e76f364fb2c62b406a97ce8f68 (diff)
tests: tests for birthday commandnlf/more-random-tests
-rw-r--r--test/lib/birthday.js84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/lib/birthday.js b/test/lib/birthday.js
new file mode 100644
index 000000000..35255f97a
--- /dev/null
+++ b/test/lib/birthday.js
@@ -0,0 +1,84 @@
+const { test } = require('tap')
+const requireInject = require('require-inject')
+
+test('birthday (nope)', (t) => {
+ t.plan(1)
+ const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
+ const f = B.from([102, 114, 111, 109])
+ const D = global[B[f]([68, 97, 116, 101])]
+ const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
+ const l = B[f]('dG9TdHJpbmc=', _6)
+ class FD extends D {
+ [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
+ return 7
+ }
+ }
+ global[B[f]([68, 97, 116, 101])] = FD
+ const consoleLog = console.log
+ console.log = () => undefined
+ t.tearDown(() => {
+ global[B[f]([68, 97, 116, 101])] = D
+ console.log = consoleLog
+ })
+ const birthday = requireInject('../../lib/birthday', {})
+ birthday([], (err) => {
+ t.match(err, 'try again', 'not telling you the secret that easily are we?')
+ })
+})
+
+test('birthday (nope again)', (t) => {
+ t.plan(1)
+ const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
+ const f = B.from([102, 114, 111, 109])
+ const D = global[B[f]([68, 97, 116, 101])]
+ const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
+ const l = B[f]('dG9TdHJpbmc=', _6)
+ class FD extends D {
+ [B[f]('Z2V0RnVsbFllYXI=', _6)[l]()] () {
+ const d = new D()
+ return d[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()]() + 1
+ }
+ [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
+ return 9
+ }
+ }
+ global[B[f]([68, 97, 116, 101])] = FD
+ const consoleLog = console.log
+ console.log = () => undefined
+ t.tearDown(() => {
+ global[B[f]([68, 97, 116, 101])] = D
+ console.log = consoleLog
+ })
+ const birthday = requireInject('../../lib/birthday', {})
+ birthday([], (err) => {
+ t.match(err, 'try again', 'not telling you the secret that easily are we?')
+ })
+})
+
+test('birthday (yup)', (t) => {
+ t.plan(1)
+ const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
+ const f = B.from([102, 114, 111, 109])
+ const D = global[B[f]([68, 97, 116, 101])]
+ const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
+ const l = B[f]('dG9TdHJpbmc=', _6)
+ class FD extends D {
+ [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
+ return 8
+ }
+ [B[f]('Z2V0VVRDRGF0ZQ==', _6)[l]()] () {
+ return 29
+ }
+ }
+ global[B[f]([68, 97, 116, 101])] = FD
+ const consoleLog = console.log
+ console.log = () => undefined
+ t.tearDown(() => {
+ global[B[f]([68, 97, 116, 101])] = D
+ console.log = consoleLog
+ })
+ const birthday = requireInject('../../lib/birthday', {})
+ birthday([], (err) => {
+ t.ifError(err, 'npm birthday')
+ })
+})