diff --git a/test/strings.js b/test/strings.js index b5928c0..afe1fe7 100644 --- a/test/strings.js +++ b/test/strings.js @@ -60,19 +60,22 @@ describe('strings', () => { }) it('truncates strings involving surrogate pairs longer than truncate (7)', () => { - expect(inspect('๐Ÿฑ๐Ÿฑ๐Ÿฑ', { truncate: 7 })).to.equal("'๐Ÿฑ๐Ÿฑโ€ฆ'") // not '๐Ÿฑ๐Ÿฑ\ud83dโ€ฆ' + // not '๐Ÿฑ๐Ÿฑ\ud83dโ€ฆ' (length 7) but '๐Ÿฑ๐Ÿฑโ€ฆ' (length 6) + expect(inspect('๐Ÿฑ๐Ÿฑ๐Ÿฑ', { truncate: 7 })).to.equal("'๐Ÿฑ๐Ÿฑโ€ฆ'") }) it('truncates strings involving surrogate pairs longer than truncate (6)', () => { - expect(inspect('๐Ÿฑ๐Ÿฑ๐Ÿฑ', { truncate: 6 })).to.equal("'๐Ÿฑโ€ฆ'") // not '๐Ÿฑ\ud83dโ€ฆ' + expect(inspect('๐Ÿฑ๐Ÿฑ๐Ÿฑ', { truncate: 6 })).to.equal("'๐Ÿฑโ€ฆ'") }) it('truncates strings involving surrogate pairs longer than truncate (5)', () => { + // not '๐Ÿฑ\ud83dโ€ฆ' (length 5) but '๐Ÿฑโ€ฆ' (length 4) expect(inspect('๐Ÿฑ๐Ÿฑ๐Ÿฑ', { truncate: 5 })).to.equal("'๐Ÿฑโ€ฆ'") }) it('truncates strings involving graphemes than truncate (5)', () => { - expect(inspect('๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง', { truncate: 5 })).to.equal("'๐Ÿ‘จโ€ฆ'") // partial support: valid string for unicode + // partial support: valid string for unicode + expect(inspect('๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง', { truncate: 5 })).to.equal("'๐Ÿ‘จโ€ฆ'") }) it('disregards truncate when it cannot truncate further (2)', () => {