Release v5.3 cherrypick #2 (#5526)

Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Voronor <129545215+voronor@users.noreply.github.com>
Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com>
Co-authored-by: Michalis Kargakis <kargakis@protonmail.com>
This commit is contained in:
Hadrien Croubois
2025-03-03 15:51:41 +01:00
committed by GitHub
parent 77a459e987
commit 887697148d
34 changed files with 1641 additions and 262 deletions

View File

@ -339,4 +339,11 @@ describe('Strings', function () {
}
});
});
describe('Escape JSON string', function () {
for (const input of ['', 'a', '{"a":"b/c"}', 'a\tb\nc\\d"e\rf/g\fh\bi'])
it(`escape ${JSON.stringify(input)}`, async function () {
await expect(this.mock.$escapeJSON(input)).to.eventually.equal(JSON.stringify(input).slice(1, -1));
});
});
});