summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2015-07-20 20:07:07 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2015-07-21 11:54:30 -0700
commit04893a736dd5132ac117190287b6e345579f9a64 (patch)
tree6fe7554a68068b2a838f96dac0952c985f5afdb7 /deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
parent6391f4d2fd7a5779e012887158e6bc69d08966e3 (diff)
downloadandroid-node-v8-04893a736dd5132ac117190287b6e345579f9a64.tar.gz
android-node-v8-04893a736dd5132ac117190287b6e345579f9a64.tar.bz2
android-node-v8-04893a736dd5132ac117190287b6e345579f9a64.zip
deps: upgrade to npm 2.13.1
PR-URL: https://github.com/nodejs/io.js/pull/2210 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/test/tap/splat-with-only-prerelease-to-latest.js')
-rw-r--r--deps/npm/test/tap/splat-with-only-prerelease-to-latest.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js b/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
new file mode 100644
index 0000000000..d402bed296
--- /dev/null
+++ b/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
@@ -0,0 +1,81 @@
+'use strict'
+var test = require('tap').test
+var npm = require('../../lib/npm')
+var log = require('npmlog')
+var stream = require('readable-stream')
+
+var moduleName = 'xyzzy-wibble'
+var testModule = {
+ name: moduleName,
+ 'dist-tags': {
+ latest: '1.3.0-a'
+ },
+ versions: {
+ '1.0.0-a': {
+ name: moduleName,
+ version: '1.0.0-a',
+ dist: {
+ shasum: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
+ tarball: 'http://registry.npmjs.org/aproba/-/xyzzy-wibble-1.0.0-a.tgz'
+ }
+ },
+ '1.1.0-a': {
+ name: moduleName,
+ version: '1.1.0-a',
+ dist: {
+ shasum: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
+ tarball: 'http://registry.npmjs.org/aproba/-/xyzzy-wibble-1.1.0-a.tgz'
+ }
+ },
+ '1.2.0-a': {
+ name: moduleName,
+ version: '1.2.0-a',
+ dist: {
+ shasum: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
+ tarball: 'http://registry.npmjs.org/aproba/-/xyzzy-wibble-1.2.0-a.tgz'
+ }
+ },
+ '1.3.0-a': {
+ name: moduleName,
+ version: '1.3.0-a',
+ dist: {
+ shasum: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
+ tarball: 'http://registry.npmjs.org/aproba/-/xyzzy-wibble-1.3.0-a.tgz'
+ }
+ },
+ },
+}
+
+var lastFetched
+test('setup', function (t) {
+ npm.load(function(){
+ npm.config.set('loglevel', 'silly')
+ npm.registry = {
+ get: function (uri, opts, cb) {
+ setImmediate(function () {
+ cb(null, testModule, null, {statusCode: 200})
+ })
+ },
+ fetch: function (u, opts, cb) {
+ lastFetched = u
+ setImmediate(function () {
+ var empty = new stream.Readable()
+ empty.push(null)
+ cb(null, empty)
+ })
+ }
+ }
+ t.end()
+ })
+})
+
+
+test('splat', function (t) {
+ t.plan(3)
+ var addNamed = require('../../lib/cache/add-named.js')
+ addNamed('xyzzy-wibble', '*', testModule, function (err, pkg) {
+ t.error(err, 'Succesfully resolved a splat package')
+ t.is(pkg.name, moduleName)
+ t.is(pkg.version, testModule['dist-tags'].latest)
+ })
+})