index.spec.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var _1 = require(".");
  4. var TEST_CASES = [
  5. // Single words.
  6. ["test", "test"],
  7. ["TEST", "test"],
  8. // Camel case.
  9. ["testString", "test string"],
  10. ["testString123", "test string123"],
  11. ["testString_1_2_3", "test string 1 2 3"],
  12. ["x_256", "x 256"],
  13. ["anHTMLTag", "an html tag"],
  14. ["ID123String", "id123 string"],
  15. ["Id123String", "id123 string"],
  16. ["foo bar123", "foo bar123"],
  17. ["a1bStar", "a1b star"],
  18. // Constant case.
  19. ["CONSTANT_CASE ", "constant case"],
  20. ["CONST123_FOO", "const123 foo"],
  21. // Random cases.
  22. ["FOO_bar", "foo bar"],
  23. ["XMLHttpRequest", "xml http request"],
  24. ["IQueryAArgs", "i query a args"],
  25. // Non-alphanumeric separators.
  26. ["dot.case", "dot case"],
  27. ["path/case", "path case"],
  28. ["snake_case", "snake case"],
  29. ["snake_case123", "snake case123"],
  30. ["snake_case_123", "snake case 123"],
  31. // Punctuation.
  32. ['"quotes"', "quotes"],
  33. // Space between number parts.
  34. ["version 0.45.0", "version 0 45 0"],
  35. ["version 0..78..9", "version 0 78 9"],
  36. ["version 4_99/4", "version 4 99 4"],
  37. // Whitespace.
  38. [" test ", "test"],
  39. // Number string input.
  40. ["something_2014_other", "something 2014 other"],
  41. // https://github.com/blakeembrey/change-case/issues/21
  42. ["amazon s3 data", "amazon s3 data"],
  43. ["foo_13_bar", "foo 13 bar"],
  44. // Customization.
  45. ["camel2019", "camel 2019", { splitRegexp: /([a-z])([A-Z0-9])/g }],
  46. ["minifyURLs", "minify urls", { splitRegexp: /([a-z])([A-Z0-9])/g }],
  47. ];
  48. describe("no case", function () {
  49. var _loop_1 = function (input, result, options) {
  50. it(input + " -> " + result, function () {
  51. expect(_1.noCase(input, options)).toEqual(result);
  52. });
  53. };
  54. for (var _i = 0, TEST_CASES_1 = TEST_CASES; _i < TEST_CASES_1.length; _i++) {
  55. var _a = TEST_CASES_1[_i], input = _a[0], result = _a[1], options = _a[2];
  56. _loop_1(input, result, options);
  57. }
  58. });
  59. //# sourceMappingURL=index.spec.js.map