-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathtest.ts
More file actions
36 lines (32 loc) · 984 Bytes
/
test.ts
File metadata and controls
36 lines (32 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { TestServer } from '@logux/server'
import { PgTable } from 'drizzle-orm/pg-core'
import { db } from './db/index.ts'
import * as tables from './db/schema.ts'
import addedModule from './modules/added.ts'
import authModule from './modules/auth.ts'
import healthModule from './modules/health.ts'
import passwordsModule from './modules/passwords.ts'
import syncModule from './modules/sync.ts'
import usersModule from './modules/users.ts'
export async function cleanSessions(): Promise<void> {
await db.delete(tables.sessions)
}
export async function cleanAllTables(): Promise<void> {
await Promise.all(
Object.values(tables).map(async table => {
if (table instanceof PgTable) {
await db.delete(table)
}
})
)
}
export function buildTestServer(): TestServer {
let server = new TestServer()
addedModule(server)
authModule(server)
healthModule(server)
usersModule(server)
passwordsModule(server)
syncModule(server)
return server
}