StringArrayCallsWrapper.spec.ts 1023 B

12345678910111213141516171819202122232425262728
  1. import { assert } from 'chai';
  2. import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
  3. import { NO_CUSTOM_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
  4. import { readFileAsString } from '../../../helpers/readFileAsString';
  5. import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscator';
  6. describe('StringArrayCallsWrapper', () => {
  7. it('should correctly append `StringArrayCallsWrapper` custom node into the obfuscated code', () => {
  8. let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
  9. readFileAsString(__dirname + '/fixtures/simple-input.js'),
  10. {
  11. ...NO_CUSTOM_NODES_PRESET,
  12. stringArray: true,
  13. stringArrayThreshold: 1,
  14. wrapStringArrayCalls: true
  15. }
  16. );
  17. assert.match(
  18. obfuscationResult.getObfuscatedCode(),
  19. /_0x([a-z0-9]){4,6} *= *_0x([a-z0-9]){4,6} *- *0x0\;/
  20. );
  21. });
  22. });