Added tests for rename-properties invalid literal node type

This commit is contained in:
sanex
2020-08-25 10:09:35 +03:00
parent 5c749343f2
commit cc7b36792a
7 changed files with 35 additions and 8 deletions
@@ -318,5 +318,30 @@ describe('RenamePropertiesTransformer', () => {
});
});
});
describe('Ignored literal node type', () => {
describe('Variant #1: boolean literal node', () => {
const regExp: RegExp = /var obj *= *{}; *obj\[!!\[]] *= *0x1;/;
let obfuscatedCode: string;
before(() => {
const code: string = readFileAsString(__dirname + '/fixtures/boolean-literal-node.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
renameProperties: true
}
).getObfuscatedCode();
});
it('Match #1: should skip literal property with invalid type', () => {
assert.match(obfuscatedCode, regExp);
});
});
});
});
});