mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user