test(all): increase unit test coverage

pull/107/head
Romain 6 years ago
parent 8bbe1186c5
commit 7208642d95

@ -0,0 +1,21 @@
const should = require('should/as-function')
const messages = require('../../bin/messages.js')
describe('messages', function () {
['SUCCESS', 'GREETING', 'SORRY'].forEach(type => {
it(`wraps ${type} messages in a box`, () => {
const success = messages[type]({})
should(success.indexOf('┌───')).above(-1)
should(success.indexOf('───┐')).above(-1)
should(success.indexOf('└───')).above(-1)
should(success.indexOf('───┘')).above(-1)
should(success.split('\n').length).above(4)
})
})
it('lists mandatory binary dependencies', () => {
const required = messages.BINARIES_REQUIRED(['bin1', 'bin2'])
should(required.indexOf('bin1\n')).above(-1)
should(required.indexOf('bin2\n')).above(-1)
})
})

@ -36,6 +36,13 @@ describe('Handlebars helpers: compare', () => {
}).throw(/operator/)
})
it('throws an error if there arent enough parameters', () => {
should(() => {
const template = handlebars.compile(`{{#compare value}}TRUE{{/compare}}`)
template({value: 3})
}).throw(/needs 2 parameters/)
})
it('keeps the context when executing the block', () => {
const template = handlebars.compile(`{{#compare value '==' 3}}{{hello}}{{/compare}}`)
const res = template({value: 3, hello: 'world'})

Loading…
Cancel
Save