Skip to content

Commit

Permalink
Add test for not found partial
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef Kababe committed Oct 19, 2015
1 parent 4b5bab5 commit 4c7ea87
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/exbars.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('Exbars', function() {
exbars.compile('someTemplate', '<h1>{{title}}</h1>');
exbars.compile('templateWithHelper', "<h1>{{someHelper 'hello'}}</h1>");
exbars.compile('templateWithPartial', "<h1>{{partial 'some_partial'}}</h1>");
exbars.compile('templateWithNFPartial', "<h1>{{partial 'not_found_partial'}}</h1>");
exbars.compile(exbars.viewsPath + '/layouts/main.hbs', '<div>{{{body}}}</div>');
exbars.compile(exbars.viewsPath + '/layouts/other.hbs', '<section>{{{body}}}</section>');
exbars.registerHelper('someHelper', function(string) { return string.toUpperCase(); });
Expand Down Expand Up @@ -110,5 +111,12 @@ describe('Exbars', function() {
done();
});
});

it('should throw an error if partial is not found', function() {
var fn = function() {
exbars.render('templateWithNFPartial', {}, function(err, result) {});
};
fn.should.throw('Failed to lookup partial "not_found_partial" in: pages/login.hbs');
});
});
});

0 comments on commit 4c7ea87

Please sign in to comment.