Skip to content

Commit 940918b

Browse files
committed
tests: add escapeId object tests
1 parent 00d34c2 commit 940918b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/unit/test-SqlString.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ test('SqlString.escapeId', {
1111
assert.equal(SqlString.escapeId(42), '`42`');
1212
},
1313

14+
'value can be an object': function() {
15+
assert.equal(SqlString.escapeId({}), '`[object Object]`');
16+
},
17+
18+
'value toString is called': function() {
19+
assert.equal(SqlString.escapeId({ toString: function() { return 'foo'; } }), '`foo`');
20+
},
21+
22+
'value toString is quoted': function() {
23+
assert.equal(SqlString.escapeId({ toString: function() { return 'f`oo'; } }), '`f``oo`');
24+
},
25+
1426
'value containing escapes is quoted': function() {
1527
assert.equal(SqlString.escapeId('i`d'), '`i``d`');
1628
},

0 commit comments

Comments
 (0)