ObfuscationTargetSanitizer.spec.ts 942 B

12345678910111213141516171819202122232425262728293031323334
  1. import { assert } from 'chai';
  2. import { ObfuscationTargetSanitizer } from '../../../../src/cli/sanitizers/ObfuscatingTargetSanitizer';
  3. describe('ObfuscationTargetSanitizer', () => {
  4. describe('Variant #1: valid obfuscation target', () => {
  5. const inputValue: string = 'browser';
  6. const expectedValue: string = inputValue;
  7. let value: string;
  8. before(() => {
  9. value = ObfuscationTargetSanitizer(inputValue);
  10. });
  11. it('should sanitize value', () => {
  12. assert.equal(value, expectedValue);
  13. });
  14. });
  15. describe('Variant #2: invalid obfuscation target', () => {
  16. const inputValue: string = 'foo';
  17. let testFunc: () => void;
  18. before(() => {
  19. testFunc = () => ObfuscationTargetSanitizer(inputValue);
  20. });
  21. it('should throw error', () => {
  22. assert.throw(testFunc, ReferenceError);
  23. });
  24. });
  25. });