Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
test: fix all test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Jan 31, 2016
1 parent 9da7c6c commit 44976f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion test/controllers/registry/package/list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ describe('controllers/registry/package/list.test.js', function () {
should.not.exist(err);
var data = res.body;
data.time.unpublished.name.should.equal('dead_horse');
data.time.unpublished.description.should.equal('moduletest1');
done();
});
});
Expand Down
21 changes: 10 additions & 11 deletions test/controllers/registry/package/show.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

var should = require('should');
var request = require('supertest');
var pedding = require('pedding');
var mm = require('mm');
var app = require('../../../../servers/registry');
var utils = require('../../../utils');
Expand All @@ -25,20 +24,20 @@ describe('controllers/registry/package/show.test.js', function () {
afterEach(mm.restore);

before(function (done) {
done = pedding(done, 2);
var pkg = utils.getPackage('@cnpmtest/testmodule-show', '0.0.1', utils.admin);
request(app.listen())
.put('/' + pkg.name)
.set('authorization', utils.adminAuth)
.send(pkg)
.expect(201, done);

pkg = utils.getPackage('@cnpmtest/testmodule-show', '1.1.0', utils.admin);
request(app.listen())
.put('/' + pkg.name)
.set('authorization', utils.adminAuth)
.send(pkg)
.expect(201, done);
.expect(201, function(err) {
should.not.exist(err);
pkg = utils.getPackage('@cnpmtest/testmodule-show', '1.1.0', utils.admin);
request(app.listen())
.put('/' + pkg.name)
.set('authorization', utils.adminAuth)
.send(pkg)
.expect(201, done);
});
});

it('should return one version', function (done) {
Expand Down Expand Up @@ -107,7 +106,7 @@ describe('controllers/registry/package/show.test.js', function () {
should.not.exist(err);
var data = res.body;
data.name.should.equal('@cnpmtest/testmodule-show');
data.version.should.equal('0.0.1');
data.version.should.equal('1.1.0');
done();
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/web/package/show.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('controllers/web/package/show.test.js', function () {
it('should display unpublished info', function (done) {
mm(config, 'syncModel', 'all');
request(app)
.get('/package/tfs')
.get('/package/moduletest1')
.expect(200)
.expect(/This package has been unpublished\./, done);
});
Expand Down

0 comments on commit 44976f4

Please sign in to comment.