From bd1f9aa78adf41252084a7e8f1fe2ba8dc5c6b9d Mon Sep 17 00:00:00 2001 From: "jialu.shen" <865332676@qq.com> Date: Tue, 17 Dec 2024 18:57:19 +0800 Subject: [PATCH] test(model): update inference tests --- .../models/widgets/QuestionAnswer.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/__tests__/models/widgets/QuestionAnswer.spec.js b/frontend/src/components/__tests__/models/widgets/QuestionAnswer.spec.js index 19ad87884..cd6b3ad4c 100644 --- a/frontend/src/components/__tests__/models/widgets/QuestionAnswer.spec.js +++ b/frontend/src/components/__tests__/models/widgets/QuestionAnswer.spec.js @@ -10,12 +10,12 @@ vi.mock("../../../packs/csrfFetch", () => { case '/predict': return Promise.resolve({ ok: true, - json: () => Promise.resolve({ result: "推理结果" }) + json: () => Promise.resolve({ result: "get result" }) }); case '/internal_api/models/test/model/predict': return Promise.resolve({ ok: true, - json: () => Promise.resolve({ result: "推理结果" }) + json: () => Promise.resolve({ result: "get result" }) }); default: return Promise.resolve({ ok: false, json: () => Promise.resolve({ message: "推理失败" }) }); @@ -50,17 +50,17 @@ describe("QuestionAnswer", () => { it("calculates text input length correctly", async () => { const wrapper = createWrapper(); - const inputText = "测试输入"; + const inputText = "test input"; await wrapper.vm.countTextLength(inputText); expect(wrapper.vm.textInputLength).toBe(inputText.length); }); it.skip("sends inference test and receives result", async () => { const wrapper = createWrapper(); - await wrapper.setData({ textInput: "测试内容" }); + await wrapper.setData({ textInput: "test input" }); await wrapper.vm.sendInferenceTest(); - expect(wrapper.vm.textOutput).toBe("推理结果"); + expect(wrapper.vm.textOutput).toBe("get result"); expect(wrapper.vm.loading).toBe(false); }); @@ -71,10 +71,10 @@ describe("QuestionAnswer", () => { }); const wrapper = createWrapper(); - await wrapper.setData({ textInput: "测试内容" }); + await wrapper.setData({ textInput: "test input" }); await wrapper.vm.sendInferenceTest(); - expect(ElMessage).toHaveBeenCalledWith({ message: '推理失败', type: "warning" }); + expect(ElMessage).toHaveBeenCalledWith({ message: 'test error', type: "warning" }); expect(wrapper.vm.loading).toBe(false); });