runManifestTest.js 1.0 KB

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. var path = require('path');
  3. var fs = require('fs');
  4. var forEach = require('foreach');
  5. var keys = require('object-keys');
  6. module.exports = function runManifestTest(test, ES, edition) {
  7. test('ES' + edition + ' manifest', { skip: !fs.readdirSync }, function (t) {
  8. var files = fs.readdirSync(path.join(__dirname, '../../' + edition), 'utf-8');
  9. var map = {
  10. AbstractEqualityComparison: 'Abstract Equality Comparison',
  11. AbstractRelationalComparison: 'Abstract Relational Comparison',
  12. StrictEqualityComparison: 'Strict Equality Comparison'
  13. };
  14. forEach(files, function (file) {
  15. var name = path.basename(file, path.extname(file));
  16. var actual = ES[map[name] || name];
  17. var expected = require(path.join(__dirname, '../../' + edition + '/', file)); // eslint-disable-line global-require
  18. t.equal(actual, expected, 'ES["' + name + '"] === ' + file);
  19. });
  20. var actualCount = keys(ES).length;
  21. t.equal(actualCount, files.length, 'expected ' + files.length + ' files, got ' + actualCount);
  22. t.end();
  23. });
  24. };