Server IP : 127.0.0.2 / Your IP : 3.129.73.179 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/npm/node_modules/npm-registry-client/test/ |
Upload File : |
var test = require('tap').test var server = require('./lib/server.js') var common = require('./lib/common.js') var client = common.freshClient() var cache = require('./fixtures/@npm/npm-registry-client/cache.json') var REV = '/-rev/213-0a1049cf56172b7d9a1184742c6477b9' var PACKAGE = '/@npm%2fnpm-registry-client' var URI = common.registry + PACKAGE var TOKEN = 'of-glad-tidings' var VERSION = '3.0.6' var AUTH = { token: TOKEN } var PARAMS = { version: VERSION, auth: AUTH } test('unpublish a package', function (t) { server.expect('GET', '/@npm%2fnpm-registry-client?write=true', function (req, res) { t.equal(req.method, 'GET') res.json(cache) }) server.expect('PUT', '/@npm%2fnpm-registry-client' + REV, function (req, res) { t.equal(req.method, 'PUT') var b = '' req.setEncoding('utf-8') req.on('data', function (d) { b += d }) req.on('end', function () { var updated = JSON.parse(b) t.notOk(updated.versions[VERSION]) }) res.json(cache) }) server.expect('GET', PACKAGE, function (req, res) { t.equal(req.method, 'GET') res.json(cache) }) server.expect( 'DELETE', PACKAGE + '/-' + PACKAGE + '-' + VERSION + '.tgz' + REV, function (req, res) { t.equal(req.method, 'DELETE') res.json({ unpublished: true }) } ) client.unpublish(URI, PARAMS, function (er) { t.ifError(er, 'no errors') server.close() t.end() }) })