Skip to content

Commit

Permalink
Fix up FormTool.test.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 19, 2024
1 parent d8b21ef commit 3277598
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client/src/components/Workflow/Editor/Forms/FormTool.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { createTestingPinia } from "@pinia/testing";
import { mount } from "@vue/test-utils";
import axios from "axios";
import MockAdapter from "axios-mock-adapter";
import flushPromises from "flush-promises";
import { getLocalVue } from "tests/jest/helpers";

import { useServerMock } from "@/api/client/__mocks__";

import FormTool from "./FormTool";

jest.mock("@/api/schema");
Expand All @@ -17,10 +20,20 @@ jest.mock("@/composables/config", () => ({

const localVue = getLocalVue();

const { server, http } = useServerMock();

describe("FormTool", () => {
const axiosMock = new MockAdapter(axios);
axiosMock.onGet(`/api/webhooks`).reply(200, []);

beforeEach(() => {
server.use(
http.get("/api/configuration", ({ response }) => {
return response(200).json({});
})
);
});

function mountTarget() {
return mount(FormTool, {
propsData: {
Expand All @@ -35,6 +48,7 @@ describe("FormTool", () => {
description: "description",
inputs: [{ name: "input", label: "input", type: "text", value: "value" }],
help: "help_text",
help_format: "restructuredtext",
versions: ["1.0", "2.0", "3.0"],
citations: false,
},
Expand Down Expand Up @@ -71,5 +85,6 @@ describe("FormTool", () => {
state = wrapper.emitted().onSetData[1][1];
expect(state.tool_version).toEqual("3.0");
expect(state.tool_id).toEqual("tool_id+3.0");
await flushPromises();
});
});

0 comments on commit 3277598

Please sign in to comment.