diff --git a/frontend/src/__tests__/BuildView.test.js b/frontend/src/__tests__/BuildView.test.js index f049e77..829ccc4 100644 --- a/frontend/src/__tests__/BuildView.test.js +++ b/frontend/src/__tests__/BuildView.test.js @@ -52,7 +52,7 @@ describe('BuildView.vue', () => { expect(wrapper.text()).toContain('代码混淆') expect(wrapper.text()).toContain('build_policy.json') expect(wrapper.find('#obfuscation').exists()).toBe(true) - expect(wrapper.find('#obfuscation').element.checked).toBe(true) + expect(wrapper.find('#obfuscation').element.checked).toBe(false) }) it('加载 apps 和 schemes', async () => { @@ -121,7 +121,7 @@ describe('BuildView.vue', () => { await flushPromises() expect(wrapper.vm.form.build_type).toBe('') - expect(wrapper.vm.form.obfuscation).toBe(true) + expect(wrapper.vm.form.obfuscation).toBe(false) expect(wrapper.vm.form.branch).toBe('main') }) @@ -158,14 +158,14 @@ describe('BuildView.vue', () => { method: 'POST', })) const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST') - expect(JSON.parse(post[1].body).obfuscation).toBe(true) + expect(JSON.parse(post[1].body).obfuscation).toBe(false) expect(wrapper.text()).toContain('打包任务已创建,正在排队,请勿重复点击。') expect(wrapper.vm.form.app_id).toBe('') expect(wrapper.vm.form.build_type).toBe('') expect(wrapper.vm.form.scheme_id).toBe('') }) - it('取消勾选混淆时提交 obfuscation=false(旧分支按勾选执行)', async () => { + it('勾选混淆时提交 obfuscation=true(旧分支按勾选执行)', async () => { fetch.mockImplementation((url, opts) => { if (url === '/api/tasks' && opts?.method === 'POST') { return Promise.resolve({ ok: true, json: () => Promise.resolve({ id: 'test-id', status: 'pending' }) }) @@ -184,12 +184,13 @@ describe('BuildView.vue', () => { wrapper.vm.selectedServer = '测试环境' await wrapper.vm.$nextTick() wrapper.vm.form.app_id = '1' - await wrapper.find('#obfuscation').setValue(false) + await wrapper.find('#obfuscation').setValue(true) await wrapper.find('.btn-primary').trigger('click') await flushPromises() const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST') - expect(JSON.parse(post[1].body).obfuscation).toBe(false) + expect(JSON.parse(post[1].body).obfuscation).toBe(true) + expect(wrapper.vm.form.obfuscation).toBe(false) }) it('未选择 App 时提示', async () => { diff --git a/frontend/src/views/BuildView.vue b/frontend/src/views/BuildView.vue index 3321540..2dd3611 100644 --- a/frontend/src/views/BuildView.vue +++ b/frontend/src/views/BuildView.vue @@ -211,7 +211,7 @@ const form = ref({ build_type: '', scheme_id: '', exclude_symbols: false, - obfuscation: true, + obfuscation: false, branch: 'main', }) const submitting = ref(false) @@ -401,7 +401,7 @@ const submitTask = async () => { build_type: '', scheme_id: '', exclude_symbols: false, - obfuscation: Boolean(supportsObfuscation.value), + obfuscation: false, branch: branches.value[0] || 'main', } } else {