Add OpenBao client integration tests
CI / integration (push) Successful in 10s
CI / check (push) Failing after 12s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-10-20 11:08:03 +01:00
1 parent de36c97f36
commit ac4307ebc8
1 file changed
+27
+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, test } from 'vitest'
import { BaoClient } from './bao'
const addr = process.env.BAO_ADDR ?? 'http://127.0.0.1:8200'
const token = process.env.BAO_TOKEN ?? 'root'
describe('BaoClient against a dev OpenBao', () => {
const client = new BaoClient(addr, token)
test('health', async () => {
const h = await client.health()
expect(h.initialized).toBe(true)
expect(h.sealed).toBe(false)
})
test('lookupSelf with root token', async () => {
expect((await client.lookupSelf()).policies).toContain('root')
})
test('bad token is a forbidden error', async () => {
await expect(client.withToken('nope').lookupSelf()).rejects.toMatchObject({ kind: 'forbidden' })
})
test('list of missing path is empty', async () => {
expect(await client.list('secret/metadata/does-not-exist')).toEqual([])
})
})