diff --git a/bin/messages.js b/bin/messages.js index 18b42ad..b65ac23 100644 --- a/bin/messages.js +++ b/bin/messages.js @@ -42,9 +42,9 @@ Thanks for using thumbsup! Don't forget to check out the docs at ${DOCS_URL}. -When building a gallery, thumbsup reports anonymous stats such as the OS and -gallery size. This is used to understand usage patterns & guide development -effort. You can disable usage reporting by specifying --no-usage-stats. +When building a gallery, thumbsup reports anonymous stats such as the +OS and gallery size. This is used to understand usage patterns & guide +development effort. You can disable this by specifying --no-usage-stats. This welcome message will not be shown again for this gallery. Enjoy! diff --git a/test/bin/messages.spec.js b/test/bin/messages.spec.js index e3c1eb8..abab9ea 100644 --- a/test/bin/messages.spec.js +++ b/test/bin/messages.spec.js @@ -2,15 +2,20 @@ 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('shows SUCCESS in a box', () => { + const stats = { albums: 1, photos: 1, videos: 1 } + const success = messages.SUCCESS(stats) + assertInABox(success) + }) + + it('shows GREETING in a box', () => { + const greeting = messages.GREETING() + assertInABox(greeting) + }) + + it('shows SORRY in a box', () => { + const sorry = messages.SORRY('thumbsup.log') + assertInABox(sorry) }) it('lists mandatory binary dependencies', () => { @@ -24,3 +29,11 @@ describe('messages', function () { should(messages.PROBLEMS(2).indexOf('with 2 files.')).above(-1) }) }) + +function assertInABox (result) { + should(result.indexOf('┌───')).above(-1) + should(result.indexOf('───┐')).above(-1) + should(result.indexOf('└───')).above(-1) + should(result.indexOf('───┘')).above(-1) + should(result.split('\n').length).above(4) +}