🎉 Initial commit: PiAgentUI — AI Agent Desktop & Web UI
Build & Push Frontend Docker Image / build-and-push (push) Canceled after 0s
Build Validation / validate (push) Canceled after 6s
Build & Push Backend Docker Image / build-and-push (push) Failing after 10m10s
Build & Push Gateway Docker Image / build-and-push (push) Failing after 10m9s
Build & Push Frontend Docker Image / build-and-push (push) Canceled after 0s
Build Validation / validate (push) Canceled after 6s
Build & Push Backend Docker Image / build-and-push (push) Failing after 10m10s
Build & Push Gateway Docker Image / build-and-push (push) Failing after 10m9s
A professional workspace for AI coding agents with: - Real-time streaming chat with SSE - Session management (fork, clone, tree navigation) - MCP tools browser & metadata panel - Skills browser (global, project, package sources) - Voice input & STT provider configuration - Integrated terminal & file explorer - Model selector with capability metadata - Keyboard-first UI with command palette - 8 languages (en, pt-BR, es, ja, zh-CN, ar, bn, hi) - Tauri 2 desktop app - React 19 + TypeScript + Vite 8 + Tailwind CSS 4 - Pi Agent extension runtime Originally forked from OpenCodeUI, now an independent project. License: GPL-3.0-only
This commit is contained in:
commit
b3489e1ede
983 files changed
+158475
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { piClient } from './piClient'
|
||||
import { serverStore } from '../store/serverStore'
|
||||
|
||||
describe('piClient Authenticated Fetch Client', () => {
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.resetModules()
|
||||
localStorage.clear()
|
||||
sessionStorage.clear()
|
||||
})
|
||||
|
||||
it('builds headers with Bearer token if running in Pi Mode', async () => {
|
||||
vi.spyOn(serverStore, 'isPiMode').mockReturnValue(true)
|
||||
vi.spyOn(serverStore, 'getActiveToken').mockReturnValue('my-test-bearer-token')
|
||||
vi.spyOn(serverStore, 'getActiveBaseUrl').mockReturnValue('http://127.0.0.1:4000')
|
||||
|
||||
const fetchSpy = vi
|
||||
.spyOn(globalThis, 'fetch')
|
||||
.mockImplementation(() => Promise.resolve(new Response(JSON.stringify({ ok: true }))))
|
||||
|
||||
const result = await piClient.get<{ ok: boolean }>('/api/test')
|
||||
expect(result.ok).toBe(true)
|
||||
|
||||
expect(fetchSpy).toHaveBeenCalledWith(
|
||||
'http://127.0.0.1:4000/api/test',
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
Authorization: 'Bearer my-test-bearer-token',
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('throws backend JSON error messages instead of generic HTTP status text', async () => {
|
||||
vi.spyOn(serverStore, 'getActiveToken').mockReturnValue('my-test-bearer-token')
|
||||
vi.spyOn(serverStore, 'getActiveBaseUrl').mockReturnValue('http://127.0.0.1:4000')
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(() =>
|
||||
Promise.resolve(
|
||||
new Response(JSON.stringify({ error: 'fatal: not a git repository' }), {
|
||||
status: 400,
|
||||
statusText: 'Bad Request',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
await expect(piClient.get('/api/vcs/status')).rejects.toThrow('fatal: not a git repository')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user