Skip to content

Commit f14fd3f

Browse files
committed
add null check as well
1 parent 3c1fc8b commit f14fd3f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/integration/v2/fetchTypes.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ describe("test type casting on fetch", () => {
104104
await connection.execute(
105105
"INSERT INTO test_struct_helper(a, b) VALUES ([1, 2], '2019-07-31 01:01:01')"
106106
);
107+
// Test null values too
108+
await connection.execute(
109+
"INSERT INTO test_struct_helper(a, b) VALUES ([3, null], null)"
110+
);
107111
await connection.execute(
108112
"INSERT INTO test_struct(id, s) SELECT 1, test_struct_helper FROM test_struct_helper"
109113
);
@@ -118,6 +122,12 @@ describe("test type casting on fetch", () => {
118122
);
119123
const row = data[0];
120124
expect((row as unknown[])[0]).toEqual({
125+
id: 1,
126+
s: { a: [3, null], b: null }
127+
});
128+
129+
const row2 = data[1];
130+
expect((row2 as unknown[])[0]).toEqual({
121131
id: 1,
122132
s: { a: [1, 2], b: "2019-07-31 01:01:01" }
123133
});

0 commit comments

Comments
 (0)