mirror of
https://github.com/thumbsup/thumbsup
synced 2024-11-07 15:20:26 +00:00
test(all): increase unit test coverage
This commit is contained in:
parent
8bbe1186c5
commit
7208642d95
21
test/bin/messages.spec.js
Normal file
21
test/bin/messages.spec.js
Normal file
@ -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…
Reference in New Issue
Block a user