feat: 自托管 AI Gateway 运维管理 SKILL
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
GatewayApiError,
|
||||
gatewayErrorMessage,
|
||||
getCurrentUser,
|
||||
getOpsManagementSkillMetadata,
|
||||
OIDC_BROWSER_SESSION_CREDENTIAL,
|
||||
} from './api';
|
||||
|
||||
@@ -65,3 +66,33 @@ describe('OIDC browser session transport', () => {
|
||||
expect(new Headers(init.headers).has('Authorization')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Public Agent resources', () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('loads operations skill metadata without authorization', async () => {
|
||||
const metadata = {
|
||||
name: 'ai-gateway-ops-management',
|
||||
version: '1.0.1',
|
||||
displayName: 'AI Gateway 运维管理',
|
||||
modules: ['model-runtime'],
|
||||
fileName: 'ai-gateway-ops-management-v1.0.1.zip',
|
||||
downloadPath: '/api/v1/public/skills/ai-gateway-ops-management/download',
|
||||
apiDocsJsonPath: '/api-docs-json',
|
||||
apiDocsYamlPath: '/api-docs-yaml',
|
||||
};
|
||||
const fetchMock = vi.fn().mockResolvedValue(new Response(JSON.stringify(metadata), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
}));
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
await expect(getOpsManagementSkillMetadata()).resolves.toEqual(metadata);
|
||||
|
||||
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
expect(url).toContain('/api/v1/public/skills/ai-gateway-ops-management/metadata');
|
||||
expect(new Headers(init.headers).has('Authorization')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user