Skip to content

Commit

Permalink
Merge pull request #15 from ericalli/main
Browse files Browse the repository at this point in the history
Fixing issue #9 with tests
  • Loading branch information
gastonrobledo authored Aug 30, 2023
2 parents 0b7ba05 + 44364ca commit b52a267
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 b52a267

Please sign in to comment.