-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preserve tags when publishing something (ref #63)
- Loading branch information
Showing
9 changed files
with
106 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"_id":"testpkg-newnpmreg","name":"testpkg-newnpmreg","description":"","dist-tags":{"foo":"0.0.0","latest":"0.0.0"},"versions":{"0.0.0":{"name":"testpkg-newnpmreg","version":"0.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":""},"author":"","license":"ISC","_id":"testpkg-newnpmreg@0.0.0","dist":{"shasum":"8ee7331cbc641581b1a8cecd9d38d744a8feb863","tarball":"http://localhost:1234/testpkg-newnpmreg/-/testpkg-newnpmreg-0.0.0.tgz"},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"alex","email":"alex@kocharin.ru"},"maintainers":[{"name":"alex","email":"alex@kocharin.ru"}]}},"readme":"","maintainers":[{"name":"alex","email":"alex@kocharin.ru"}],"_attachments":{"testpkg-newnpmreg-0.0.0.tgz":{"content_type":"application/octet-stream","data":"H4sIAAAAAAAAA+2TsW7CMBCGM/spTh6YKHUSIJLXqkPnrixWcIMLsS3btCDEu/fs0Ba1SFVVVISUP8Odzqf/zlY+K+qlaOSt7eLo2RudnVmMsel4DBjzasKOY1JZlJDlRVkU5aSspnnG8pIVOZ6fe5FTWvsgHK7yV5/uLvARr0Q7qkUrKadB+mCXzY2Wr9q2TjZ0SF+k88poPGUj/LAyl752yoauioVWqJgpPZcb/Hmw0jV4ynfJEw9lvTAwo/fOGcdBG4h18FbW6knJ+YzCYAByowLkdD+kTlrjVTBumzy2Nq7XqIDea7eKY7FJrMPCuG6Hlaql9rHr4fGO7i/9pFcl+4X/rWhX557xA/9FVZ3gv+j5/w9F+jl8g58c0OeQyCdH3HOglETsObxTTw7McwLJClt+wzz5JD45IPEcEHjMEfg0r8M9pQfaOSDs5NLP16tXr15XqzeJD6m5AAwAAA==","length":352}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ | |
} | ||
}, | ||
"dist-tags": { | ||
"latest": "5.4.3", | ||
"something": "0.1.1alpha", | ||
"bad": "1.1" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
var assert = require('assert') | ||
|
||
function readfile(x) { | ||
return require('fs').readFileSync(__dirname + '/' + x) | ||
} | ||
|
||
function sha(x) { | ||
return require('crypto').createHash('sha1', 'binary').update(x).digest('hex') | ||
} | ||
|
||
module.exports = function() { | ||
var server = process.server | ||
var server2 = process.server2 | ||
|
||
describe('newnpmreg', function() { | ||
before(function(cb) { | ||
server.request({ | ||
uri: '/testpkg-newnpmreg', | ||
headers: { | ||
'content-type': 'application/json', | ||
}, | ||
method: 'PUT', | ||
json: JSON.parse(readfile('fixtures/newnpmreg.json')), | ||
}, function(err, res, body) { | ||
assert.equal(res.statusCode, 201) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('add pkg', function(){}) | ||
|
||
it('server1 - tarball', function(cb) { | ||
server.get_tarball('testpkg-newnpmreg', 'testpkg-newnpmreg-0.0.0.tgz', function(res, body) { | ||
assert.equal(res.statusCode, 200) | ||
// not real sha due to utf8 conversion | ||
assert.strictEqual(sha(body), '789ca61e3426ce55c4983451b58e62b04abceaf6') | ||
cb() | ||
}) | ||
}) | ||
|
||
it('server2 - tarball', function(cb) { | ||
server2.get_tarball('testpkg-newnpmreg', 'testpkg-newnpmreg-0.0.0.tgz', function(res, body) { | ||
assert.equal(res.statusCode, 200) | ||
// not real sha due to utf8 conversion | ||
assert.strictEqual(sha(body), '789ca61e3426ce55c4983451b58e62b04abceaf6') | ||
cb() | ||
}) | ||
}) | ||
|
||
it('server1 - package', function(cb) { | ||
server.get_package('testpkg-newnpmreg', function(res, body) { | ||
assert.equal(res.statusCode, 200) | ||
assert.equal(body.name, 'testpkg-newnpmreg') | ||
assert.equal(body.versions['0.0.0'].name, 'testpkg-newnpmreg') | ||
assert.equal(body.versions['0.0.0'].dist.tarball, 'http://localhost:55551/testpkg-newnpmreg/-/testpkg-newnpmreg-0.0.0.tgz') | ||
assert.deepEqual(body['dist-tags'], {foo: '0.0.0', latest: '0.0.0'}) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('server2 - package', function(cb) { | ||
server2.get_package('testpkg-newnpmreg', function(res, body) { | ||
assert.equal(res.statusCode, 200) | ||
assert.equal(body.name, 'testpkg-newnpmreg') | ||
assert.equal(body.versions['0.0.0'].name, 'testpkg-newnpmreg') | ||
assert.equal(body.versions['0.0.0'].dist.tarball, 'http://localhost:55552/testpkg-newnpmreg/-/testpkg-newnpmreg-0.0.0.tgz') | ||
assert.deepEqual(body['dist-tags'], {foo: '0.0.0', latest: '0.0.0'}) | ||
cb() | ||
}) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters