var R = require('../source');var eq = require('./shared/eq');var fs = require('fs');var path = require('path');
function sourceMethods(dir) { var isJsFile = function(file) { return file.match(/\.js$/); }; var isIndex = R.equals('index.js'); var removeJsEnding = function(file) { return file.replace('.js', ''); }; return fs.readdirSync(dir).filter(R.both(R.complement(isIndex), isJsFile)).map(removeJsEnding);}
describe('API surface', function() { if (typeof require.resolve !== 'function') { return; } var exported = Object.keys(R).filter(function(key) { return key !== '__esModule'; }); var actual = sourceMethods(path.dirname(require.resolve('../source')));
it('both APIs are in sync', function() { eq(actual.length, exported.length); });
it('list of not exported API methods is empty', function() { function isNotExported(method) { return exported.indexOf(method) === -1; } eq(actual.filter(isNotExported), []); });});