diff --git a/src/core/operations/FromBase91.mjs b/src/core/operations/FromBase91.mjs index 921434dd..08abb710 100644 --- a/src/core/operations/FromBase91.mjs +++ b/src/core/operations/FromBase91.mjs @@ -23,6 +23,17 @@ class FromBase91 extends Operation { this.infoURL = "https://en.wikipedia.org/wiki/Binary-to-text_encoding#Encoding_standards"; this.inputType = "string"; this.outputType = "ArrayBuffer"; + this.checks = [ + { + pattern: + "^" + + "[\\s0-9A-Za-z!#$%&()*+,./:;<=>?@\\\[\\\]\\^_`{|}~\"]*" + + "[0-9A-Za-z!#$%&()*+,./:;<=>?@\\\[\\\]\\^_`{|}~\"]{15}" + + "[\\s0-9A-Za-z!#$%&()*+,./:;<=>?@\\\[\\\]\\^_`{|}~\"]*" + + "$", + args: [] + } + ]; } /** diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index f147e9e7..9b25fb2f 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -24,6 +24,7 @@ import "./tests/Base58.mjs"; import "./tests/Base62.mjs"; import "./tests/Base64.mjs"; import "./tests/Base85.mjs"; +import "./tests/Base91.mjs"; import "./tests/Base92.mjs"; import "./tests/BCD.mjs"; import "./tests/BitwiseOp.mjs"; diff --git a/tests/operations/tests/Base91.mjs b/tests/operations/tests/Base91.mjs new file mode 100644 index 00000000..f75d2b96 --- /dev/null +++ b/tests/operations/tests/Base91.mjs @@ -0,0 +1,35 @@ +/** + * Base91 tests + * + * @author ialejandrozalles + * @license Apache-2.0 + */ +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + { + name: "To Base91", + input: "hello", + expectedOutput: "TPwJh>A", + recipeConfig: [ + { op: "To Base91", args: [] } + ] + }, + { + name: "From Base91", + input: "TPwJh>A", + expectedOutput: "hello", + recipeConfig: [ + { op: "From Base91", args: [] } + ] + }, + { + name: "To/From Base91 Roundtrip", + input: "The quick brown fox jumps over the lazy dog", + expectedOutput: "The quick brown fox jumps over the lazy dog", + recipeConfig: [ + { op: "To Base91", args: [] }, + { op: "From Base91", args: [] } + ] + } +]); diff --git a/tests/operations/tests/Magic.mjs b/tests/operations/tests/Magic.mjs index 90401dc1..7a7d15d4 100644 --- a/tests/operations/tests/Magic.mjs +++ b/tests/operations/tests/Magic.mjs @@ -153,4 +153,16 @@ TestRegister.addTests([ } ] } + , + { + name: "Magic Chain: Base91", + input: "xD7ghoHB4!#/Tm_ogr$J9[JTrUJ*|jgSr!=EWoFB", + expectedMatch: /From_Base91\(\)/, + recipeConfig: [ + { + op: "Magic", + args: [3, false, false] + } + ], + } ]);