test(verify): initial suite
This commit is contained in:
parent
689f37ae2e
commit
c47ff97ab3
53
test/specs/verify.js
Normal file
53
test/specs/verify.js
Normal file
@ -0,0 +1,53 @@
|
||||
const test = require('tap').test
|
||||
|
||||
const verify = require('../../dist/lib/verify')
|
||||
|
||||
test('verify pkg, options and env', (t) => {
|
||||
t.test('dry run verification', (tt) => {
|
||||
const noErrors = verify({
|
||||
name: 'package',
|
||||
repository: {
|
||||
url: 'http://github.com/whats/up.git'
|
||||
}
|
||||
}, {
|
||||
debug: true
|
||||
}, {})
|
||||
|
||||
tt.is(noErrors.length, 0)
|
||||
|
||||
const errors = verify({}, {
|
||||
debug: true
|
||||
}, {})
|
||||
|
||||
tt.is(errors.length, 2)
|
||||
tt.is(errors[0].code, 'ENOPKGNAME')
|
||||
tt.is(errors[1].code, 'ENOPKGREPO')
|
||||
|
||||
tt.end()
|
||||
})
|
||||
|
||||
t.test('publish verification', (tt) => {
|
||||
const noErrors = verify({
|
||||
name: 'package',
|
||||
repository: {
|
||||
url: 'http://github.com/whats/up.git'
|
||||
}
|
||||
}, {
|
||||
'github-token': 'sup'
|
||||
}, {
|
||||
NPM_TOKEN: 'yo'
|
||||
})
|
||||
|
||||
tt.is(noErrors.length, 0)
|
||||
|
||||
const errors = verify({}, {}, {})
|
||||
|
||||
tt.is(errors.length, 4)
|
||||
tt.is(errors[0].code, 'ENOPKGNAME')
|
||||
tt.is(errors[1].code, 'ENOPKGREPO')
|
||||
tt.is(errors[2].code, 'ENOGHTOKEN')
|
||||
tt.is(errors[3].code, 'ENONPMTOKEN')
|
||||
|
||||
tt.end()
|
||||
})
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user