Skip to content

Commit 4f7b551

Browse files
committed
add failing test for #1418 regression
1 parent 6c29e36 commit 4f7b551

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/integration/connection/test-typecast.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const common = require('../../common');
44
const connection = common.createConnection();
55
const assert = require('assert');
66

7+
connection.query('CREATE TEMPORARY TABLE json_test (json_test JSON)');
8+
connection.query('INSERT INTO json_test VALUES (?)', JSON.stringify({ test: 42 }));
9+
710
connection.query(
811
{
912
sql: 'select "foo uppercase" as foo',
@@ -46,4 +49,18 @@ connection.query(
4649
}
4750
);
4851

52+
connection.query(
53+
{
54+
sql: 'SELECT * from json_test',
55+
typeCast: function(_field, next) {
56+
return next();
57+
}
58+
},
59+
(err, _rows) => {
60+
assert.ifError(err);
61+
assert.equal(_rows[0].test.test, 42);
62+
}
63+
);
64+
65+
4966
connection.end();

0 commit comments

Comments
 (0)