IdentifierNamesGeneratorSanitizer.spec.ts 993 B

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