bom_test.js 595 B

1234567891011121314151617181920212223242526
  1. var assert = require("assert");
  2. var concat = require("concat-stream");
  3. var fs = require("fs");
  4. var hbsfy = require("hbsfy");
  5. var templatePath = __dirname + "/bom.hbs";
  6. var reBOM = /^\uFEFF/;
  7. // Ensure our fixture actually contains a BOM
  8. fs.createReadStream(templatePath)
  9. .pipe(concat(function(data) {
  10. assert(
  11. reBOM.test(data.toString()),
  12. "The template should contain a bom"
  13. );
  14. }));
  15. fs.createReadStream(templatePath)
  16. .pipe(hbsfy(templatePath))
  17. .pipe(concat(function(data) {
  18. assert(
  19. reBOM.test(data.toString()) === false,
  20. "The template should not contain a bom"
  21. );
  22. }));