MCPcopy Index your code
hub / github.com/Waishnav/devspace / testDatabaseConfiguration

Function testDatabaseConfiguration

src/oauth-store.test.ts:32–55  ·  view source on GitHub ↗
(stateDir: string)

Source from the content-addressed store, hash-verified

30}
31
32async function testDatabaseConfiguration(stateDir: string): Promise<void> {
33 const database = openDatabase(stateDir);
34 try {
35 assert.equal(database.sqlite.pragma("journal_mode", { simple: true }), "wal");
36 assert.equal(database.sqlite.pragma("synchronous", { simple: true }), 1);
37 assert.equal(database.sqlite.pragma("busy_timeout", { simple: true }), 5000);
38 assert.equal(database.sqlite.pragma("foreign_keys", { simple: true }), 1);
39
40 const migrations = database.sqlite
41 .prepare("select version, name from devspace_schema_migrations order by version")
42 .all();
43 assert.deepEqual(migrations, [
44 { version: 1, name: "workspace-state" },
45 { version: 2, name: "oauth-state" },
46 ]);
47 } finally {
48 database.close();
49 }
50
51 if (process.platform !== "win32") {
52 assert.equal((await stat(stateDir)).mode & 0o777, 0o700);
53 assert.equal((await stat(databasePath(stateDir))).mode & 0o777, 0o600);
54 }
55}
56
57function testPersistenceAndTokenHashing(stateDir: string): void {
58 const accessToken = "access-token-example";

Callers 1

Calls 3

openDatabaseFunction · 0.85
databasePathFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected