How to write invalid input for encodeURIComponent()
?
I browsed the documentation for encodeURIComponent. It mentions
URIError: Thrown if uriComponent contains a lone surrogate.
How to test this while writing a unit test?
CodePudding user response:
You can try an invalid unicode symbol. Something like this: encodeURIComponent('\uDFFF');