Added tests for renameProperties option integration with splitStrings option

This commit is contained in:
sanex3339
2020-06-07 18:48:37 +03:00
parent 5811d649cd
commit a89e614ceb
2 changed files with 28 additions and 0 deletions
@@ -292,6 +292,31 @@ describe('RenamePropertiesTransformer', () => {
assert.match(obfuscatedCode, regExp);
});
});
describe('Variant #8: integration with `splitStrings` option', () => {
const propertyRegExp: RegExp = /'a': *'long' *\+ *'Prop' *\+ *'erty' *\+ *'Valu' *\+ *'e'/;
let obfuscatedCode: string;
before(() => {
const code: string = readFileAsString(__dirname + '/fixtures/split-strings-integration.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
renameProperties: true,
identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator,
splitStrings: true,
splitStringsChunkLength: 4
}
).getObfuscatedCode();
});
it('Should rename property before `splitStrings` option will applied', () => {
assert.match(obfuscatedCode, propertyRegExp);
});
});
});
});
});
@@ -0,0 +1,3 @@
const foo = {
longPropertyName: 'longPropertyValue'
};