ConusAI vendor v0.1.0-dev.20261013+85463d22
This commit is contained in:
parent
c3c6526952
commit
0da8a2a81b
@@ -0,0 +1,25 @@
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
|
||||
// The platform description read failed (401/403/5xx from the platform): the
|
||||
// page must still render the linked-services list it owns.
|
||||
vi.mock('@/shared/api', () => ({
|
||||
platformInfo: vi.fn(async () => null),
|
||||
}))
|
||||
vi.mock('@/shared/config', () => ({
|
||||
getEnv: () => ({}),
|
||||
modules: () => ({ kv: true, nats: false, qdrant: false, git: false, s3: false }),
|
||||
}))
|
||||
|
||||
describe('PlatformPage', () => {
|
||||
it('renders the linked services and a placeholder when the description is unavailable', async () => {
|
||||
const { PlatformPage } = await import('@/views/platform/ui/PlatformPage')
|
||||
const markup = renderToStaticMarkup(await PlatformPage())
|
||||
expect(markup).toContain('Linked services')
|
||||
// Every module is listed, linked or not (React splits text nodes with
|
||||
// comments in static markup, so match the elements, not the joined text).
|
||||
expect(markup.match(/<li>/g)).toHaveLength(5)
|
||||
expect(markup).toContain('not linked')
|
||||
expect(markup).toContain('unavailable')
|
||||
})
|
||||
})
|
||||
@@ -5,7 +5,8 @@ import { getEnv, modules } from '@/shared/config'
|
||||
* The platform's own description, read through the typed API (plan §4.4), and the
|
||||
* optional services this deployment is linked to. The platform has no token-accessible
|
||||
* listing of a project's services (D8), so the linked list is read from the variables
|
||||
* the platform injected at deploy time.
|
||||
* the platform injected at deploy time. When the description read fails the page
|
||||
* renders the list it owns and a placeholder.
|
||||
*/
|
||||
export async function PlatformPage() {
|
||||
const info = await platformInfo()
|
||||
@@ -22,7 +23,11 @@ export async function PlatformPage() {
|
||||
))}
|
||||
</ul>
|
||||
<h2>Description</h2>
|
||||
<pre>{JSON.stringify(info, null, 2)}</pre>
|
||||
{info ? (
|
||||
<pre>{JSON.stringify(info, null, 2)}</pre>
|
||||
) : (
|
||||
<p>The platform description is unavailable.</p>
|
||||
)}
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user