/*********************** * Tests ***********************/ describe('obfuscate', function() { scriptFiles.forEach((scriptFile) => { it(`runs ${scriptFile} correctly`, function() { const args = ' tree dog "third arg"' const fullPath = path.join(SCRIPT_DIR, scriptFile); const expected = shell.exec(fullPath + args, { silent: true }).stdout; const fileContents = fs.readFileSync(fullPath, 'utf-8'); const obfuscated = obfuscate(fileContents, 5, true); fs.writeFileSync('temp.sh', obfuscated); shell.chmod('+x', 'temp.sh') const actual = shell.exec('./temp.sh' + args, { silent: true }); actual.should.equal(expected); fs.unlinkSync('temp.sh'); }); }); });