ConusAI vendor v0.1.0-dev.20261013+85463d22

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261013+85463d22
2026-10-13 20:45:57 +00:00
parent c3c6526952
commit 0da8a2a81b
67 changed files with 1510 additions and 10153 deletions
+40
View File
@@ -0,0 +1,40 @@
import { describe, expect, it, vi } from 'vitest'
vi.mock('@/shared/config/env', () => ({
getEnv: () => ({
CONUSAI_API_URL: 'https://console.example.com',
CONUSAI_API_TOKEN: 'dt_fixture',
}),
}))
// The platform answering 403 (a deployment token the catalog routes reject)
// throws inside the SDK call when throwOnError is set.
vi.mock('@conusai-sdk/api', () => ({
getPlatformInfo: vi.fn(async () => {
throw Object.assign(new Error('forbidden'), { status: 403 })
}),
getServiceType: vi.fn(async () => {
throw Object.assign(new Error('forbidden'), { status: 403 })
}),
}))
describe('platform reads when the platform refuses them', () => {
it('serviceCatalogEntry returns null on a 403 instead of throwing during render', async () => {
const { serviceCatalogEntry } = await import('@/shared/api/platform/server')
await expect(serviceCatalogEntry('redis')).resolves.toBeNull()
})
it('platformInfo returns null on a 403 instead of throwing during render', async () => {
const { platformInfo } = await import('@/shared/api/platform/server')
await expect(platformInfo()).resolves.toBeNull()
})
it('logs the failure once per read, not once per request', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
const { serviceCatalogEntry } = await import('@/shared/api/platform/server')
await serviceCatalogEntry('qdrant')
await serviceCatalogEntry('qdrant')
expect(warn).toHaveBeenCalledTimes(1)
warn.mockRestore()
})
})