Base62.mjs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Base62 tests.
  3. *
  4. * @author tcode2k16 [tcode2k16@gmail.com]
  5. *
  6. * @copyright Crown Copyright 2018
  7. * @license Apache-2.0
  8. */
  9. import TestRegister from "../../TestRegister";
  10. TestRegister.addTests([
  11. {
  12. name: "To Base62: nothing",
  13. input: "",
  14. expectedOutput: "",
  15. recipeConfig: [
  16. {
  17. op: "To Base62",
  18. args: ["0-9A-Za-z"],
  19. },
  20. ],
  21. },
  22. {
  23. name: "To Base62: Hello, World!",
  24. input: "Hello, World!",
  25. expectedOutput: "1wJfrzvdbtXUOlUjUf",
  26. recipeConfig: [
  27. {
  28. op: "To Base62",
  29. args: ["0-9A-Za-z"],
  30. },
  31. ],
  32. },
  33. {
  34. name: "To Base62: UTF-8",
  35. input: "ნუ პანიკას",
  36. expectedOutput: "BPDNbjoGvDCDzHbKT77eWg0vGQrJuWRXltuRVZ",
  37. recipeConfig: [
  38. {
  39. op: "To Base62",
  40. args: ["0-9A-Za-z"],
  41. },
  42. ],
  43. },
  44. {
  45. name: "From Base62: nothing",
  46. input: "",
  47. expectedOutput: "",
  48. recipeConfig: [
  49. {
  50. op: "From Base62",
  51. args: ["0-9A-Za-z"],
  52. },
  53. ],
  54. },
  55. {
  56. name: "From Base62: Hello, World!",
  57. input: "1wJfrzvdbtXUOlUjUf",
  58. expectedOutput: "Hello, World!",
  59. recipeConfig: [
  60. {
  61. op: "From Base62",
  62. args: ["0-9A-Za-z"],
  63. },
  64. ],
  65. },
  66. {
  67. name: "From Base62: UTF-8",
  68. input: "BPDNbjoGvDCDzHbKT77eWg0vGQrJuWRXltuRVZ",
  69. expectedOutput: "ნუ პანიკას",
  70. recipeConfig: [
  71. {
  72. op: "From Base62",
  73. args: ["0-9A-Za-z"],
  74. },
  75. ],
  76. }
  77. ]);