1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-08 23:25:51 +01:00
verdaccio/test/functional/addtag.js
2015-04-11 20:11:04 +03:00

47 lines
1.3 KiB
JavaScript

function readfile(x) {
return require('fs').readFileSync(__dirname + '/' + x)
}
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/)
})
})
}