OptionsNormalizer.spec.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { IObfuscatorOptions } from "../../src/interfaces/IObfuscatorOptions";
  2. import { OptionsNormalizer } from '../../src/OptionsNormalizer';
  3. import { DEFAULT_PRESET } from '../../src/preset-options/DefaultPreset';
  4. const assert: Chai.AssertStatic = require('chai').assert;
  5. describe('OptionsNormalizer', () => {
  6. describe('normalizeOptions (options: IObfuscatorOptions): IObfuscatorOptions', () => {
  7. let optionsPreset1: IObfuscatorOptions;
  8. beforeEach(() => {
  9. optionsPreset1 = Object.assign({}, DEFAULT_PRESET, {
  10. compact: false,
  11. rotateUnicodeArray: true,
  12. unicodeArray: false,
  13. unicodeArrayThreshold: 0.5,
  14. wrapUnicodeArrayCalls: true
  15. });
  16. });
  17. it('should normalize options preset', () => {
  18. assert.deepEqual(
  19. OptionsNormalizer.normalizeOptions(optionsPreset1), Object.assign({}, DEFAULT_PRESET, {
  20. compact: true,
  21. rotateUnicodeArray: false,
  22. unicodeArray: false,
  23. unicodeArrayThreshold: 0,
  24. wrapUnicodeArrayCalls: false
  25. })
  26. );
  27. });
  28. });
  29. });