mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 09:57:47 +08:00
fix(gateway): support claude_code cross-format Claude messages
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const { patchMock } = vi.hoisted(() => ({
|
||||
patchMock: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('@/api/client', () => ({
|
||||
default: {
|
||||
patch: patchMock,
|
||||
},
|
||||
}))
|
||||
|
||||
import { meApi } from '@/api/me'
|
||||
|
||||
describe('meApi API key status', () => {
|
||||
beforeEach(() => {
|
||||
patchMock.mockReset()
|
||||
patchMock.mockResolvedValue({
|
||||
data: {
|
||||
id: 'user-key-1',
|
||||
is_active: false,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('sends the desired disabled state in the patch body', async () => {
|
||||
await meApi.toggleApiKey('user-key-1', false)
|
||||
|
||||
expect(patchMock).toHaveBeenCalledWith(
|
||||
'/api/users/me/api-keys/user-key-1',
|
||||
{ is_active: false },
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -300,8 +300,10 @@ export const meApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
async toggleApiKey(keyId: string): Promise<ApiKey> {
|
||||
const response = await apiClient.patch<ApiKey>(`/api/users/me/api-keys/${keyId}`)
|
||||
async toggleApiKey(keyId: string, isActive: boolean): Promise<ApiKey> {
|
||||
const response = await apiClient.patch<ApiKey>(`/api/users/me/api-keys/${keyId}`, {
|
||||
is_active: isActive,
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user