mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-05-05 05:30:44 +08:00
- 接入 gpt-5.4-mini/nano 模型识别与规范化,补充默认模型列表 - 增加 gpt-5.4-mini/nano 输入/缓存命中/输出价格与计费兜底逻辑 - 同步前端模型白名单与 OpenCode 配置 - 补充 service tier(priority/flex) 计费回归测试
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { nextTick } from 'vue'
|
|
|
|
vi.mock('vue-i18n', () => ({
|
|
useI18n: () => ({
|
|
t: (key: string) => key
|
|
})
|
|
}))
|
|
|
|
vi.mock('@/composables/useClipboard', () => ({
|
|
useClipboard: () => ({
|
|
copyToClipboard: vi.fn().mockResolvedValue(true)
|
|
})
|
|
}))
|
|
|
|
import UseKeyModal from '../UseKeyModal.vue'
|
|
|
|
describe('UseKeyModal', () => {
|
|
it('renders updated GPT-5.4 mini/nano names in OpenCode config', async () => {
|
|
const wrapper = mount(UseKeyModal, {
|
|
props: {
|
|
show: true,
|
|
apiKey: 'sk-test',
|
|
baseUrl: 'https://example.com/v1',
|
|
platform: 'openai'
|
|
},
|
|
global: {
|
|
stubs: {
|
|
BaseDialog: {
|
|
template: '<div><slot /><slot name="footer" /></div>'
|
|
},
|
|
Icon: {
|
|
template: '<span />'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
const opencodeTab = wrapper.findAll('button').find((button) =>
|
|
button.text().includes('keys.useKeyModal.cliTabs.opencode')
|
|
)
|
|
|
|
expect(opencodeTab).toBeDefined()
|
|
await opencodeTab!.trigger('click')
|
|
await nextTick()
|
|
|
|
const codeBlock = wrapper.find('pre code')
|
|
expect(codeBlock.exists()).toBe(true)
|
|
expect(codeBlock.text()).toContain('"name": "GPT-5.4 Mini"')
|
|
expect(codeBlock.text()).toContain('"name": "GPT-5.4 Nano"')
|
|
})
|
|
})
|