1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-24 11:13:18 +00:00
musix-oss/node_modules/es-abstract/test/helpers/runManifestTest.js

28 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
'use strict';
var path = require('path');
var fs = require('fs');
var forEach = require('foreach');
var keys = require('object-keys');
module.exports = function runManifestTest(test, ES, edition) {
test('ES' + edition + ' manifest', { skip: !fs.readdirSync }, function (t) {
var files = fs.readdirSync(path.join(__dirname, '../../' + edition), 'utf-8');
var map = {
AbstractEqualityComparison: 'Abstract Equality Comparison',
AbstractRelationalComparison: 'Abstract Relational Comparison',
StrictEqualityComparison: 'Strict Equality Comparison'
};
forEach(files, function (file) {
var name = path.basename(file, path.extname(file));
var actual = ES[map[name] || name];
var expected = require(path.join(__dirname, '../../' + edition + '/', file)); // eslint-disable-line global-require
t.equal(actual, expected, 'ES["' + name + '"] === ' + file);
});
var actualCount = keys(ES).length;
t.equal(actualCount, files.length, 'expected ' + files.length + ' files, got ' + actualCount);
t.end();
});
};