Skip to content

Commit a845bce

Browse files
committed
test consolidate
1 parent fd61067 commit a845bce

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

test/parallel/test-sqlite-data-types.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ suite('data binding and mapping', () => {
4646
stmt.run(4, 99n, 0xf, '', new Uint8Array()),
4747
{ changes: 1, lastInsertRowid: 4 },
4848
);
49-
t.assert.deepStrictEqual(
50-
stmt.run(5, undefined, undefined, undefined, undefined),
51-
{ changes: 1, lastInsertRowid: 5 },
52-
);
5349

5450
const query = db.prepare('SELECT * FROM types WHERE key = ?');
5551
t.assert.deepStrictEqual(query.get(1), {
@@ -84,20 +80,16 @@ suite('data binding and mapping', () => {
8480
text: '',
8581
buf: new Uint8Array(),
8682
});
87-
t.assert.deepStrictEqual(query.get(5), {
88-
__proto__: null,
89-
key: 5,
90-
int: null,
91-
double: null,
92-
text: null,
93-
buf: null,
94-
});
9583

96-
const insertNamed = db.prepare('INSERT INTO types VALUES ($key, $int, $double, $text, $buf)');
97-
const params = { int: undefined, double: undefined, text: undefined, buf: undefined };
9884
const nulls = { int: null, double: null, text: null, buf: null };
99-
t.assert.deepStrictEqual(insertNamed.run({ key: 6, ...params }), { changes: 1, lastInsertRowid: 6 });
85+
const undefArray = [ undefined, undefined, undefined, undefined ];
86+
const undefObj = { int: undefined, double: undefined, text: undefined, buf: undefined };
87+
const insertAnon = db.prepare('INSERT INTO types VALUES (?, ?, ?, ?, ?)');
88+
const insertNamed = db.prepare('INSERT INTO types VALUES ($key, $int, $double, $text, $buf)');
89+
t.assert.deepStrictEqual(insertAnon.run(5, ...undefArray), { changes: 1, lastInsertRowid: 5 });
90+
t.assert.deepStrictEqual(insertNamed.run({ key: 6, ...undefObj }), { changes: 1, lastInsertRowid: 6 });
10091
t.assert.deepStrictEqual(insertNamed.run({ key: 7 }), { changes: 1, lastInsertRowid: 7 });
92+
t.assert.deepStrictEqual(query.get(5), { __proto__: null, key: 5, ...nulls });
10193
t.assert.deepStrictEqual(query.get(6), { __proto__: null, key: 6, ...nulls });
10294
t.assert.deepStrictEqual(query.get(7), { __proto__: null, key: 7, ...nulls });
10395
});

0 commit comments

Comments
 (0)