Skip to content

Commit c2ff16d

Browse files
committed
fix: expect 40412 for removed managed provider write paths
1 parent 305f576 commit c2ff16d

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

‎packages/agent-gateway/test/modelCatalogProviderWrite.test.ts‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -489,14 +489,10 @@ describe('server-v2 /api/v1 provider write endpoints', () => {
489489
expect(providers.body.data.items).toEqual([]);
490490
});
491491

492-
it('rejects deleting an OAuth-managed provider with 40003', async () => {
492+
it('maps a removed managed provider id to 40412 on delete', async () => {
493493
await boot(MANAGED_TOML);
494494
const { body } = await deleteJson<unknown>('/api/v1/providers/managed%3Apythinker-code');
495-
expect(body?.code).toBe(40003);
496-
expect(body?.msg).toContain('/auth/logout');
497-
498-
const providers = await getJson<{ items: Array<{ id: string }> }>('/api/v1/providers');
499-
expect(providers.body.data.items.map((p) => p.id)).toEqual(['openai']);
495+
expect(body?.code).toBe(40412);
500496
});
501497

502498
it('maps an unknown provider id to 40412 on delete', async () => {
@@ -795,19 +791,13 @@ describe('server-v2 /api/v1 provider write endpoints', () => {
795791
}
796792
});
797793

798-
it('rejects replacing an OAuth-managed provider with 40003', async () => {
794+
it('maps a removed managed provider id to 40412 on replace', async () => {
799795
await boot(MANAGED_TOML);
800796
const { body } = await putJson<unknown>(
801797
'/api/v1/providers/managed%3Apythinker-code',
802798
REPLACE_BODY,
803799
);
804-
expect(body.code).toBe(40003);
805-
expect(body.msg).toContain('/auth/logout');
806-
807-
const providers = await getJson<{ items: Array<{ id: string }> }>('/api/v1/providers');
808-
expect(providers.body.data.items.map((p) => p.id)).toEqual(['openai']);
809-
const models = await getJson<{ items: Array<{ model: string }> }>('/api/v1/models');
810-
expect(models.body.data.items.map((m) => m.model)).toEqual(['openai/kimi-k2']);
800+
expect(body.code).toBe(40412);
811801
});
812802

813803
it('maps an unknown provider id to 40412 on replace', async () => {

0 commit comments

Comments
 (0)