I tried to implement the solution proposed in this thread to decode a string with html entities, e.g. "foo bar" to "foo bar".
Visually, it seems to work. But my quick Jest test fails:
Expected: "foobar"
Received: "foobar"
3 | describe('encryption/decodeHtml', () => {
4 | it.each([['foo bar', 'foo bar'], ['foo­bar', 'foobar'], ['foo&bar', 'foo&bar']])('should decode html entities', (val, expected) => {
> 5 | expect(decodeHtml(val)).toEqual(expected);
| ^
6 | })
7 | });
8 |
A quick Object.is(decodeHtml(' '), ' ')
also produces false
.
Is there something to JS-Strings I'm not familiar with?