Skip to content
This repository
Browse code

handle null template paths on asset bundler

  • Loading branch information...
commit 1e2ffb650aefa3d37d07cffeb561becaf65640da 1 parent e902dd6
Lakshan Perera authored

Showing 2 changed files with 11 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 lib/asset_bundler.js
  2. +7 0 spec/asset_bundler.spec.js
4 lib/asset_bundler.js
@@ -46,6 +46,10 @@ module.exports = {
46 46 compileAndMinify: function(template_path, template_extension, compiler, minifier, callback) {
47 47 var self = this;
48 48
  49 + if(!template_path) {
  50 + return callback("Template path can't be null", null);
  51 + }
  52 +
49 53 if (!minifier) {
50 54 return callback("No minifier found", null);
51 55 }
7 spec/asset_bundler.spec.js
@@ -363,6 +363,13 @@ describe("prepare a bundle", function() {
363 363
364 364 describe("compile and minify", function() {
365 365
  366 + it("call the callback with an error if template path is null", function() {
  367 + var spyCallback = jasmine.createSpy();
  368 + asset_bundler.compileAndMinify(null, ".js", {}, null, spyCallback);
  369 +
  370 + expect(spyCallback).toHaveBeenCalledWith("Template path can't be null", null);
  371 + });
  372 +
366 373 it("call the callback with an error if no minifier found", function() {
367 374 var spyCallback = jasmine.createSpy();
368 375 asset_bundler.compileAndMinify("path/test.js", ".js", {}, null, spyCallback);

0 comments on commit 1e2ffb6

Please sign in to comment.
Something went wrong with that request. Please try again.