1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/functional/addtag.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2013-12-29 07:40:47 +01:00
function readfile(x) {
return require('fs').readFileSync(__dirname + '/' + x)
2013-12-29 07:40:47 +01:00
}
module.exports = function () {
var 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(){})
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/)
})
})
2013-12-29 07:40:47 +01:00
}