refactor(mocks): extract from specs

This commit is contained in:
Stephan Bönnemann
2015-06-14 21:07:39 -07:00
parent a405021d08
commit 66bf8ff710
5 changed files with 49 additions and 47 deletions
+16
View File
@@ -0,0 +1,16 @@
const rawCommits = [
'hash-one==SPLIT==commit-one==END==\n',
'hash-two==SPLIT==commit-two==END==\n'
]
module.exports = {
exec: (command, cb) => {
cb(
null,
/\.\.HEAD/.test(command) ?
rawCommits[0] :
rawCommits.join()
)
},
'@noCallThru': true
}
+20
View File
@@ -0,0 +1,20 @@
const nock = require('nock')
const availableModule = {
'dist-tags': {
latest: '1.33.7'
},
versions: {
'1.33.7': {
gitHead: 'HEAD'
}
}
}
module.exports = nock('http://registry.npmjs.org')
.get('/available')
.reply(200, availableModule)
.get('/@scoped/available')
.reply(200, availableModule)
.get('/unavailable')
.reply(404, {})