Skip to content

Commit a89e614

Browse files
author
sanex3339
committed
Added tests for renameProperties option integration with splitStrings option
1 parent 5811d64 commit a89e614

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

test/functional-tests/node-transformers/rename-properties-transformers/rename-properties-transformer/RenamePropertiesTransformer.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,31 @@ describe('RenamePropertiesTransformer', () => {
292292
assert.match(obfuscatedCode, regExp);
293293
});
294294
});
295+
296+
describe('Variant #8: integration with `splitStrings` option', () => {
297+
const propertyRegExp: RegExp = /'a': *'long' *\+ *'Prop' *\+ *'erty' *\+ *'Valu' *\+ *'e'/;
298+
299+
let obfuscatedCode: string;
300+
301+
before(() => {
302+
const code: string = readFileAsString(__dirname + '/fixtures/split-strings-integration.js');
303+
304+
obfuscatedCode = JavaScriptObfuscator.obfuscate(
305+
code,
306+
{
307+
...NO_ADDITIONAL_NODES_PRESET,
308+
renameProperties: true,
309+
identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator,
310+
splitStrings: true,
311+
splitStringsChunkLength: 4
312+
}
313+
).getObfuscatedCode();
314+
});
315+
316+
it('Should rename property before `splitStrings` option will applied', () => {
317+
assert.match(obfuscatedCode, propertyRegExp);
318+
});
319+
});
295320
});
296321
});
297322
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const foo = {
2+
longPropertyName: 'longPropertyValue'
3+
};

0 commit comments

Comments
 (0)