index.spec.js 2.0 KB

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