mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
function readfile(x) {
|
|
return require('fs').readFileSync(__dirname + '/' + x);
|
|
}
|
|
|
|
module.exports = function() {
|
|
let server = process.server;
|
|
|
|
it('add tag - 404', function() {
|
|
return server.add_tag('testpkg-tag', 'tagtagtag', '0.0.1').status(404).body_error(/no such package/);
|
|
});
|
|
|
|
describe('addtag', function() {
|
|
before(function() {
|
|
return server.put_package('testpkg-tag', eval(
|
|
'(' + 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.add_tag('testpkg-tag', 'tagtagtag', '0.0.1-x')
|
|
.status(404)
|
|
.body_error(/version doesn't exist/);
|
|
});
|
|
|
|
it('add tag - bad tag', function() {
|
|
return server.add_tag('testpkg-tag', 'tag/tag/tag', '0.0.1-x')
|
|
.status(403)
|
|
.body_error(/invalid tag/);
|
|
});
|
|
|
|
it('add tag - good', function() {
|
|
return server.add_tag('testpkg-tag', 'tagtagtag', '0.0.1')
|
|
.status(201)
|
|
.body_ok(/tagged/);
|
|
});
|
|
});
|
|
};
|