(stateDir: string)
| 30 | } |
| 31 | |
| 32 | async 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 | |
| 57 | function testPersistenceAndTokenHashing(stateDir: string): void { |
| 58 | const accessToken = "access-token-example"; |
no test coverage detected