Skip to content

Commit

Permalink
Fixing issue gastonrobledo#9 with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericalli committed May 13, 2023
1 parent 0b7ba05 commit 44364ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions helpers/each.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ module.exports = (handlebars) => {

if (i === 0) {
ret = inverse(this)
ret = [inverse(this)]
}

return ret.join('')
Expand Down
8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ describe('Test async helpers', () => {
should.equal(result, expected)
})

it('Test each helper with an empty item list', async () => {
const hbs = asyncHelpers(Handlebars)

const items = [],
result = await hbs.compile('Devs \n{{#each items}}{{/each}}')({items})
should.equal(result, 'Devs \n')
})

it('check version', () => {
const hbs = asyncHelpers(Handlebars)
should(hbs.ASYNC_VERSION).equal(require('../package.json').version)
Expand Down

0 comments on commit 44364ca

Please sign in to comment.