OptionsPresetSanitizer.spec.ts 922 B

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