Skip to content

Commit 60a20e1

Browse files
committed
fix: add test case for empty blob
1 parent 67bd3c6 commit 60a20e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/blob.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,18 @@ describe('blob', function() {
5151
done();
5252
});
5353
});
54+
55+
it('should be able to select empty blobs', function(done) {
56+
const empty = new sqlite3.Database(':memory:');
57+
empty.serialize(function() {
58+
empty.run("CREATE TABLE files (id INTEGER PRIMARY KEY, data BLOB)");
59+
empty.run("INSERT INTO files (data) VALUES (X'')");
60+
});
61+
empty.get("SELECT data FROM files LIMIT 1", (err, row) => {
62+
if (err) throw err;
63+
assert.ok(Buffer.isBuffer(row.data));
64+
assert.equal(row.data.length, 0);
65+
empty.close(done);
66+
});
67+
})
5468
});

0 commit comments

Comments
 (0)