mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
27 lines
915 B
TypeScript
27 lines
915 B
TypeScript
import { assert } from 'chai';
|
|
|
|
import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
|
|
|
|
import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
|
|
|
|
import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscator';
|
|
|
|
describe('StringArrayCallsWrapper', () => {
|
|
it('should correctly append `StringArrayCallsWrapper` custom node into the obfuscated code', () => {
|
|
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
|
`var test = 'test';`,
|
|
{
|
|
...NO_CUSTOM_NODES_PRESET,
|
|
stringArray: true,
|
|
stringArrayThreshold: 1,
|
|
wrapStringArrayCalls: true
|
|
}
|
|
);
|
|
|
|
assert.match(
|
|
obfuscationResult.getObfuscatedCode(),
|
|
/_0x([a-z0-9]){4,6} *= *_0x([a-z0-9]){4,6} *- *0x0\;/
|
|
);
|
|
});
|
|
});
|