mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
add new test
This commit is contained in:
parent
4b1fdc457d
commit
d8d26463db
1 changed files with 15 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
|||
import crypto from "crypto";
|
||||
import crypto from "crypto";
|
||||
import crypto from 'crypto';
|
||||
import fs from "node:fs";
|
||||
import { fileURLToPath } from "url";
|
||||
import path from "node:path"
|
||||
|
@ -27,6 +30,18 @@ new DualTest("foobar.db", { readonly: true })
|
|||
t.is(db.readonly, true);
|
||||
});
|
||||
|
||||
const genDatabaseFilename = () => {
|
||||
return `test-${crypto.randomBytes(8).toString('hex')}.db`;
|
||||
};
|
||||
|
||||
new DualTest().onlySqlitePasses("opening a read-only database fails if the file doesn't exist", async (t) => {
|
||||
t.throws(() => t.context.connect(genDatabaseFilename(), { readonly: true }),
|
||||
{
|
||||
any: true,
|
||||
code: 'SQLITE_CANTOPEN',
|
||||
});
|
||||
})
|
||||
|
||||
foobarTest.both("Property .readonly of database if not set", async (t) => {
|
||||
const db = t.context.db;
|
||||
t.is(db.readonly, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue