complex-tests.js 684 B

123456789101112131415161718192021222324252627
  1. var fs = require('fs'),
  2. path = require('path'),
  3. html = require('../'),
  4. test = require('tap').test;
  5. var fixturesPath = path.join(__dirname, 'fixtures', 'complex'),
  6. tmpl = fs.readFileSync(path.join(fixturesPath, 'in.html'), 'utf8'),
  7. out = fs.readFileSync(path.join(fixturesPath, 'out.html'), 'utf8');
  8. test('complex', function (t) {
  9. var data = {
  10. sessionName: "Sam",
  11. welcome: "Hello there!",
  12. users: [
  13. { name: "Bob", email: "bob@bob.com"},
  14. { name: "Marak", email: "marak@marak.com", 'name.href': "http://marak.com"},
  15. { name: "Foo", email: "foo@bar.com"}
  16. ]
  17. };
  18. t.equal(
  19. html.render(data, tmpl),
  20. out
  21. );
  22. t.end();
  23. });