refactor(mocks): extract from specs
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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, {})
|
||||
Reference in New Issue
Block a user