test: add data to database before serializing to ensure compatibility

Empty in-memory databases may not be serializable on some SQLite versions
(like system SQLite on macOS). Added table creation and data insertion
to make the database serializable across all platforms.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-08-27 22:20:45 +00:00
parent e59f612b70
commit 57ec2ff80b

View File

@@ -24,6 +24,10 @@ test("serialize with invalid argument should throw proper error (issue 6549)", (
test("serialize with valid database name should work", () => {
const db = new Database(":memory:");
// Create a table and insert data to make database serializable
db.run("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)");
db.run("INSERT INTO test (name) VALUES ('test_data')");
// This should work with the default "main" database
const result = db.serialize();
expect(result).toBeInstanceOf(Buffer);