IdentifierNamesGeneratorSanitizer.spec.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { assert } from 'chai';
  2. import { IdentifierNamesGeneratorSanitizer } from '../../../../src/cli/sanitizers/IdentifierNamesGeneratorSanitizer';
  3. describe('IdentifierNamesGeneratorSanitizer', () => {
  4. describe('IdentifierNamesGeneratorSanitizer: TCLISanitizer = (value: string): string', () => {
  5. describe('variant #1: valid identifier names generator', () => {
  6. const inputValue: string = 'mangled';
  7. const expectedValue: string = inputValue;
  8. let value: string;
  9. before(() => {
  10. value = IdentifierNamesGeneratorSanitizer(inputValue);
  11. });
  12. it('should sanitize value', () => {
  13. assert.equal(value, expectedValue);
  14. });
  15. });
  16. describe('variant #2: invalid identifier names generator', () => {
  17. const inputValue: string = 'foo';
  18. let testFunc: () => void;
  19. before(() => {
  20. testFunc = () => IdentifierNamesGeneratorSanitizer(inputValue);
  21. });
  22. it('should throw error', () => {
  23. assert.throw(testFunc, ReferenceError);
  24. });
  25. });
  26. });
  27. });