generate.js 680 B

12345678910111213141516171819202122232425
  1. // These tests are meant to develop over time.
  2. // New tests can be added to validate.json
  3. // Regenerate the tests.html file with the following command 'node generate.js'
  4. // underscore.js is required. It can be installed with 'npm install underscore'
  5. var fs = require('fs');
  6. var _ = require('underscore');
  7. // load emojis
  8. var emojis = JSON.parse(fs.readFileSync('validate.json'), 'utf8');
  9. // load template
  10. var data = fs.readFileSync('template.html');
  11. data = data.toString();
  12. var template = _.template(data);
  13. var testFile = template(emojis);
  14. // write test file
  15. var output_path = 'tests.html';
  16. fs.writeFileSync(output_path, testFile);
  17. console.log('Generated ' + output_path);