test(type): initial suite
This commit is contained in:
parent
861debb85e
commit
f79e26dcd6
44
test/specs/type.js
Normal file
44
test/specs/type.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
const test = require('tap').test
|
||||||
|
|
||||||
|
const type = require('../../dist/lib/type.js')
|
||||||
|
|
||||||
|
test('get type from commits', (t) => {
|
||||||
|
t.test('get type from plugin', (t) => {
|
||||||
|
type({
|
||||||
|
analyze: () => 'major'
|
||||||
|
}, {
|
||||||
|
commits: [{
|
||||||
|
hash: '0',
|
||||||
|
message: 'a'
|
||||||
|
}],
|
||||||
|
lastRelease: {
|
||||||
|
version: '1.0.0'
|
||||||
|
}
|
||||||
|
}, (err, type) => {
|
||||||
|
t.error(err)
|
||||||
|
t.is(type, 'major')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('error when no changes', (t) => {
|
||||||
|
type({
|
||||||
|
analyze: () => null
|
||||||
|
}, {
|
||||||
|
commits: [],
|
||||||
|
lastRelease: {}
|
||||||
|
}, (err) => {
|
||||||
|
t.is(err.code, 'ENOCHANGE')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('initial version', (t) => {
|
||||||
|
type({}, {
|
||||||
|
lastRelease: {
|
||||||
|
version: null
|
||||||
|
}
|
||||||
|
}, (err, type) => {
|
||||||
|
t.error(err)
|
||||||
|
t.is(type, 'initial')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user