Pretty-print [new String("")] as "[ '' ]" not "[]"

This commit is contained in:
Steve Gravrock
2022-03-14 18:47:23 -07:00
parent 7f75f23e5b
commit dfa5b6a53d
3 changed files with 10 additions and 2 deletions

View File

@@ -5,6 +5,14 @@ describe('PrettyPrinter', function() {
expect(pp("som' string")).toEqual("'som' string'");
});
it('stringifies empty string primitives and objects recognizably', function() {
const pp = jasmineUnderTest.makePrettyPrinter();
expect(pp(new String(''))).toEqual(pp(''));
expect(pp(new String(''))).toEqual("''");
expect(pp([new String('')])).toEqual(pp(['']));
expect(pp([new String('')])).toEqual("[ '' ]");
});
it('should stringify primitives properly', function() {
var pp = jasmineUnderTest.makePrettyPrinter();
expect(pp(true)).toEqual('true');