This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
183 additions
and
49 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 |
---|---|---|
|
@@ -73,27 +73,41 @@ describe('controllers/registry/module.test.js', function () { | |
res.body.should.have.keys('_id', '_rev', 'name', 'description', | ||
'versions', 'dist-tags', 'readme', 'maintainers', | ||
'time', 'author', 'repository', '_attachments'); | ||
res.body.author.should.eql({ | ||
"name": "fengmk2", | ||
"email": "[email protected]", | ||
"url": "http://fengmk2.github.com" | ||
}); | ||
// res.body.author.should.eql({ | ||
// "name": "fengmk2", | ||
// "email": "[email protected]", | ||
// "url": "http://fengmk2.github.com" | ||
// }); | ||
res.body.name.should.equal('cnpmjs.org'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('GET /:name/:version', function () { | ||
describe('GET /:name/:(version|tag)', function () { | ||
it('should return module@version info', function (done) { | ||
request(app) | ||
.get('/cnpmjs.org/0.0.2') | ||
.get('/cnpmjs.org/0.0.4') | ||
.expect(200, function (err, res) { | ||
should.not.exist(err); | ||
var body = res.body; | ||
body.name.should.equal('cnpmjs.org'); | ||
body.version.should.equal('0.0.4'); | ||
body._id.should.equal('[email protected]'); | ||
body.dist.should.have.keys('tarball', 'shasum', 'size'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should return module@tag info', function (done) { | ||
request(app) | ||
.get('/cnpmjs.org/latest') | ||
.expect(200, function (err, res) { | ||
should.not.exist(err); | ||
var body = res.body; | ||
body.name.should.equal('cnpmjs.org'); | ||
body.version.should.equal('0.0.2'); | ||
body._id.should.equal('[email protected].2'); | ||
body.version.should.equal('0.0.4'); | ||
body._id.should.equal('[email protected].4'); | ||
body.dist.should.have.keys('tarball', 'shasum', 'size'); | ||
done(); | ||
}); | ||
|
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
/*! | ||
* cnpmjs.org - test/controllers/registry/user.test.js | ||
/**! | ||
* cnpmjs.org - test/middleware/auth.test.js | ||
* | ||
* Copyright(c) cnpmjs.org and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* dead_horse <[email protected]> (http://deadhorse.me) | ||
* fengmk2 <[email protected]> (http://fengmk2.github.com) | ||
*/ | ||
|
||
|
@@ -20,7 +21,7 @@ var app = require('../../servers/registry'); | |
var mm = require('mm'); | ||
var mysql = require('../../common/mysql'); | ||
|
||
describe('middleware/auth', function () { | ||
describe('middleware/auth.test.js', function () { | ||
before(function (done) { | ||
app.listen(0, done); | ||
}); | ||
|
@@ -56,6 +57,6 @@ describe('middleware/auth', function () { | |
.get('/-/user/org.couchdb.user:cnpmjstest10') | ||
.set('authorization', 'basic ' + new Buffer('cnpmjstest10:cnpmjstest10').toString('base64')) | ||
.expect(500, done); | ||
}); | ||
}); | ||
}); | ||
}); |