diff options
Diffstat (limited to 'spec/runtime.js')
-rw-r--r-- | spec/runtime.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/runtime.js b/spec/runtime.js new file mode 100644 index 0000000..4431a68 --- /dev/null +++ b/spec/runtime.js @@ -0,0 +1,36 @@ +/*globals Handlebars, shouldThrow */ + +describe('runtime', function() { + describe('#template', function() { + it('should throw on invalid templates', function() { + shouldThrow(function() { + Handlebars.template({}); + }, Error, 'Unknown template object: object'); + shouldThrow(function() { + Handlebars.template(); + }, Error, 'Unknown template object: undefined'); + shouldThrow(function() { + Handlebars.template(''); + }, Error, 'Unknown template object: string'); + }); + it('should throw on version mismatch', function() { + shouldThrow(function() { + Handlebars.template({ + main: true, + compiler: [Handlebars.COMPILER_REVISION + 1] + }); + }, Error, /Template was precompiled with a newer version of Handlebars than the current runtime/); + shouldThrow(function() { + Handlebars.template({ + main: true, + compiler: [Handlebars.COMPILER_REVISION - 1] + }); + }, Error, /Template was precompiled with an older version of Handlebars than the current runtime/); + shouldThrow(function() { + Handlebars.template({ + main: true + }); + }, Error, /Template was precompiled with an older version of Handlebars than the current runtime/); + }); + }); +}); |