feat(api): NestJS standalone 骨架 + Drizzle/postgres.js 接入
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { getDb } from '../src/db/client.js'
|
||||
|
||||
describe('数据库连接', () => {
|
||||
it('连接本项目 PG(5434)并响应 select 1', async () => {
|
||||
const db = getDb()
|
||||
// postgres.js 驱动下 drizzle 的 execute 返回 RowList(行数组),
|
||||
// 不是 node-postgres 风格的 { rows: [...] },故直接取 r[0]
|
||||
const r = (await db.execute('select 1 as ok')) as any
|
||||
expect(Number(r[0].ok)).toBe(1)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user