Obfuscator now returns an empty string instead of obfuscated code if source code is empty

This commit is contained in:
sanex3339
2016-08-07 13:47:26 +03:00
parent f258be294e
commit a2ce24a206
5 changed files with 95 additions and 75 deletions
@@ -53,9 +53,9 @@ describe('JavaScriptObfuscator', () => {
it('should returns object with empty obfuscated code and source map with empty data if source code is empty', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
'',
Object.assign({}, NO_CUSTOM_NODES_PRESET, {
{
sourceMap: true
})
}
);
assert.isNotOk(obfuscationResult.getObfuscatedCode());
@@ -65,11 +65,18 @@ describe('JavaScriptObfuscator', () => {
});
});
it('should returns empty string if source code is empty', () => {
it('should returns an empty string if source code is empty', () => {
assert.isNotOk(
JavaScriptObfuscator.obfuscate(
'',
Object.assign({}, NO_CUSTOM_NODES_PRESET)
''
).getObfuscatedCode()
);
});
it('should returns an empty string if source code contains only comments', () => {
assert.isNotOk(
JavaScriptObfuscator.obfuscate(
'// comment'
).getObfuscatedCode()
);
});