0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/functional/addtag.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-04-19 14:15:28 -05:00
'use strict';
2013-12-29 01:40:47 -05:00
function readfile(x) {
2017-04-19 14:15:28 -05:00
return require('fs').readFileSync(__dirname + '/' + x);
2013-12-29 01:40:47 -05:00
}
2017-04-19 14:15:28 -05:00
module.exports = function() {
let server = process.server;
2017-04-19 14:15:28 -05:00
it('add tag - 404', function() {
return server.addTag('testpkg-tag', 'tagtagtag', '0.0.1').status(404).body_error(/no such package/);
2017-04-19 14:15:28 -05:00
});
describe('addtag', function() {
2017-04-19 14:15:28 -05:00
before(function() {
return server.putPackage('testpkg-tag', eval(
2017-04-19 14:15:28 -05:00
'(' + readfile('fixtures/publish.json5')
.toString('utf8')
.replace(/__NAME__/g, 'testpkg-tag')
.replace(/__VERSION__/g, '0.0.1')
+ ')'
)).status(201);
});
it('add testpkg-tag', function() {
// TODO: ?
});
it('add tag - bad ver', function() {
return server.addTag('testpkg-tag', 'tagtagtag', '0.0.1-x')
2017-04-19 14:15:28 -05:00
.status(404)
.body_error(/version doesn't exist/);
});
2017-04-19 14:15:28 -05:00
it('add tag - bad tag', function() {
return server.addTag('testpkg-tag', 'tag/tag/tag', '0.0.1-x')
2017-04-19 14:15:28 -05:00
.status(403)
.body_error(/invalid tag/);
});
2017-04-19 14:15:28 -05:00
it('add tag - good', function() {
return server.addTag('testpkg-tag', 'tagtagtag', '0.0.1')
2017-04-19 14:15:28 -05:00
.status(201)
.body_ok(/tagged/);
});
});
};