Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
4.2 KiB
JSON
1 line
4.2 KiB
JSON
{"repo": "ameliacai67/project37", "files": {"frontend/tests/unit/views/SetupView.spec.js": {"8987b2da96ab056a648252a58a1f373d4a680171": {"t": 1786068493.7842152, "n": 3764, "h": "4c2e47abd8181957", "c": "import { describe, it, expect, vi, beforeEach } from 'vitest'\nimport { mount, flushPromises } from '@vue/test-utils'\nimport SetupView from '@/views/SetupView.vue'\nimport { configApi } from '@/api/config'\n\nconst mockReplace = vi.fn()\n\nvi.mock('vue-router', () => ({\n useRouter: () => ({ replace: mockReplace })\n}))\n\nvi.mock('@/api/config', () => ({\n configApi: { update: vi.fn(() => Promise.resolve()) }\n}))\n\ndescribe('SetupView', () => {\n beforeEach(() => {\n vi.clearAllMocks()\n })\n\n it('默认选中 DeepSeek 并预填 base_url 与模型', () => {\n const wrapper = mount(SetupView)\n expect(wrapper.find('select').element.value).toBe('deepseek')\n expect(wrapper.vm.form.llm_base_url).toBe('https://api.deepseek.com/v1')\n expect(wrapper.vm.form.llm_model).toBe('deepseek-chat')\n })\n\n it('切换服务商自动填充 base_url 和默认模型', async () => {\n const wrapper = mount(SetupView)\n const select = wrapper.find('select')\n await select.setValue('kimi')\n expect(wrapper.vm.form.llm_base_url).toBe('https://api.moonshot.cn/v1')\n expect(wrapper.vm.form.llm_model).toBe('kimi-k2-0905-preview')\n\n await select.setValue('zhipu')\n expect(wrapper.vm.form.llm_base_url).toBe('https://open.bigmodel.cn/api/paas/v4')\n expect(wrapper.vm.form.llm_model).toBe('glm-4-plus')\n })\n\n it('选择自定义服务商时显示 Base URL 输入框', async () => {\n const wrapper = mount(SetupView)\n expect(wrapper.find('input[placeholder=\"https://your-api-host/v1\"]').exists()).toBe(false)\n await wrapper.find('select').setValue('custom')\n expect(wrapper.find('input[placeholder=\"https://your-api-host/v1\"]').exists()).toBe(true)\n })\n\n it('默认不设置备选模型,选中后显示备选字段并自动填充', async () => {\n const wrapper = mount(SetupView)\n expect(wrapper.vm.form.llm_fallback_provider).toBe('')\n expect(wrapper.find('input[list=\"fallback-model-options\"]').exists()).toBe(false)\n\n const fallbackSelect = wrapper.findAll('select')[1]\n await fallbackSelect.setValue('qwen')\n expect(wrapper.vm.form.llm_fallback_base_url).toBe('https://dashscope.aliyuncs.com/compatible-mode/v1')\n expect(wrapper.vm.form.llm_fallback_model).toBe('qwen-plus')\n expect(wrapper.find('input[list=\"fallback-model-options\"]').exists()).toBe(true)\n })\n\n it('取消备选后清空备选字段', async () => {\n const wrapper = mount(SetupView)\n const fallbackSelect = wrapper.findAll('select')[1]\n await fallbackSelect.setValue('kimi')\n await fallbackSelect.setValue('')\n expect(wrapper.vm.form.llm_fallback_model).toBe('')\n expect(wrapper.vm.form.llm_fallback_base_url).toBe('')\n })\n\n it('提交时携带所选服务商配置', async () => {\n const wrapper = mount(SetupView)\n await wrapper.find('select').setValue('qwen')\n await wrapper.find('input[type=\"password\"]').setValue('sk-test')\n await wrapper.find('form').trigger('submit.prevent')\n await flushPromises()\n expect(configApi.update).toHaveBeenCalledWith(expect.objectContaining({\n llm_provider: 'qwen',\n llm_api_key: 'sk-test',\n llm_base_url: 'https://dashscope.aliyuncs.com/compatible-mode/v1',\n llm_model: 'qwen-plus'\n }))\n expect(mockReplace).toHaveBeenCalledWith('/')\n })\n\n it('提交时携带备选模型配置', async () => {\n const wrapper = mount(SetupView)\n await wrapper.find('input[type=\"password\"]').setValue('sk-main')\n const fallbackSelect = wrapper.findAll('select')[1]\n await fallbackSelect.setValue('kimi')\n await wrapper.findAll('input[type=\"password\"]')[1].setValue('sk-fb')\n await wrapper.find('form').trigger('submit.prevent')\n await flushPromises()\n expect(configApi.update).toHaveBeenCalledWith(expect.objectContaining({\n llm_fallback_provider: 'kimi',\n llm_fallback_api_key: 'sk-fb',\n llm_fallback_model: 'kimi-k2-0905-preview',\n llm_fallback_base_url: 'https://api.moonshot.cn/v1'\n }))\n })\n})\n"}}}} |