Add espaceJSON to String.sol (#5508)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
This commit is contained in:
Sambhav Jain
2025-03-03 20:01:43 +05:30
committed by GitHub
parent 3882a09163
commit fa995ef1fe
3 changed files with 57 additions and 0 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));
});
});
});