serverless: Add Statement.run() method

This commit is contained in:
Pekka Enberg
2025-07-22 15:29:02 +03:00
parent c58511b71c
commit 099dba4ba9
2 changed files with 24 additions and 0 deletions

View File

@@ -45,6 +45,12 @@ test.serial('prepare() method creates statement', async t => {
t.is(rows[0][1], 'John Doe');
});
test.serial('Statement.run()', async t => {
const stmt = client.prepare('INSERT INTO test_users (name, email) VALUES (?, ?)');
const row = await stmt.run(['Jane Doe', 'jane@example.com']);
t.is(row.lastInsertRowid, 2);
});
test.serial('statement iterate() method works', async t => {
// Ensure test data exists
await client.execute('CREATE TABLE IF NOT EXISTS test_users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)');