Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Commit

Permalink
test(initial-release): add test case for empty request body
Browse files Browse the repository at this point in the history
  • Loading branch information
boennemann committed Aug 18, 2015
1 parent bdf2ebc commit 0b1bc86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/mocks/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ module.exports = nock('http://registry.npmjs.org')
.reply(200, availableModule)
.get('/unavailable')
.reply(404, {})
.get('/unavailable-no-body')
.reply(404)
13 changes: 11 additions & 2 deletions test/specs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const lastRelease = require('../../')

const npm = {
registry: 'http://registry.npmjs.org/',
tag: 'latest'
tag: 'latest',
loglevel: 'error'
}

test('last release from registry', (t) => {
Expand Down Expand Up @@ -66,14 +67,22 @@ test('last release from registry', (t) => {
})

t.test('get nothing from not yet published package name', (tt) => {
tt.plan(4)

lastRelease({}, {
pkg: {name: 'unavailable'},
npm
}, (err, release) => {
tt.error(err)
tt.is(release.version, undefined, 'no version')
})

tt.end()
lastRelease({}, {
pkg: {name: 'unavailable-no-body'},
npm
}, (err, release) => {
tt.error(err)
tt.is(release.version, undefined, 'no version')
})
})
})

0 comments on commit 0b1bc86

Please sign in to comment.