diff --git a/app/static/tests/unit/components/help/draggableDialog.test.ts b/app/static/tests/unit/components/help/draggableDialog.test.ts index d544893c..ebef18c8 100644 --- a/app/static/tests/unit/components/help/draggableDialog.test.ts +++ b/app/static/tests/unit/components/help/draggableDialog.test.ts @@ -1,11 +1,11 @@ import { mount, shallowMount } from "@vue/test-utils"; import VueFeather from "vue-feather"; import { nextTick } from "vue"; -import DraggableDialog from "../../../../src/app/components/help/DraggableDialog.vue"; +import DraggableDialog from "../../../../src/components/help/DraggableDialog.vue"; -const docAddListenerSpy = jest.spyOn(document, "addEventListener"); -const docRemoveListenerSpy = jest.spyOn(document, "removeEventListener"); -const winAddListenerSpy = jest.spyOn(window, "addEventListener"); +const docAddListenerSpy = vi.spyOn(document, "addEventListener"); +const docRemoveListenerSpy = vi.spyOn(document, "removeEventListener"); +const winAddListenerSpy = vi.spyOn(window, "addEventListener"); describe("DraggableDialog", () => { const getWrapper = () => { @@ -20,7 +20,7 @@ describe("DraggableDialog", () => { }; beforeEach(() => { - jest.resetAllMocks(); + vi.resetAllMocks(); }); it("renders as expected", () => { @@ -55,7 +55,7 @@ describe("DraggableDialog", () => { const moveEvent = { clientX: moveTo.x, clientY: moveTo.y, - preventDefault: jest.fn() + preventDefault: vi.fn() }; moveHandler(moveEvent); expect((wrapper.vm as any).position).toStrictEqual(expectedEndPosition); @@ -64,7 +64,7 @@ describe("DraggableDialog", () => { // End drag const endHandlerIndex = touch ? 3 : 2; // touchend or mouseup const mouseUpHandler = docAddListenerSpy.mock.calls[endHandlerIndex][1] as any; - const mouseUpEvent = { preventDefault: jest.fn() }; + const mouseUpEvent = { preventDefault: vi.fn() }; mouseUpHandler(mouseUpEvent); expect(docRemoveListenerSpy).toHaveBeenCalledTimes(4); expect(docRemoveListenerSpy.mock.calls[0][0]).toBe("mousemove"); @@ -131,7 +131,7 @@ describe("DraggableDialog", () => { const moveEvent = { clientX: resizeTo.x, clientY: resizeTo.y, - preventDefault: jest.fn() + preventDefault: vi.fn() }; moveHandler(moveEvent); expect((wrapper.vm as any).resizedSize).toStrictEqual(expectedEndSize); @@ -140,7 +140,7 @@ describe("DraggableDialog", () => { // End resize const endHandlerIndex = touch ? 3 : 2; // touchend or mouseup const endHandler = docAddListenerSpy.mock.calls[endHandlerIndex][1] as any; - const endEvent = { preventDefault: jest.fn() }; + const endEvent = { preventDefault: vi.fn() }; endHandler(endEvent); expect(docRemoveListenerSpy).toHaveBeenCalledTimes(4); expect(docRemoveListenerSpy.mock.calls[0][0]).toBe("mousemove"); diff --git a/app/static/tests/unit/components/help/genericHelp.test.ts b/app/static/tests/unit/components/help/genericHelp.test.ts index 9820d4e8..17ff0e8a 100644 --- a/app/static/tests/unit/components/help/genericHelp.test.ts +++ b/app/static/tests/unit/components/help/genericHelp.test.ts @@ -1,9 +1,9 @@ import { mount } from "@vue/test-utils"; import VueFeather from "vue-feather"; -import GenericHelp from "../../../../src/app/components/help/GenericHelp.vue"; -import DraggableDialog from "../../../../src/app/components/help/DraggableDialog.vue"; +import GenericHelp from "../../../../src/components/help/GenericHelp.vue"; +import DraggableDialog from "../../../../src/components/help/DraggableDialog.vue"; -const mockTooltipDirective = jest.fn(); +const mockTooltipDirective = vi.fn(); describe("GenericHelp", () => { const getWrapper = () => { return mount(GenericHelp, { @@ -23,7 +23,7 @@ describe("GenericHelp", () => { }; beforeEach(() => { - jest.resetAllMocks(); + vi.resetAllMocks(); }); it("renders as expected", () => { diff --git a/app/static/tests/unit/components/help/helpTab.test.ts b/app/static/tests/unit/components/help/helpTab.test.ts index 82e37556..2eaf0314 100644 --- a/app/static/tests/unit/components/help/helpTab.test.ts +++ b/app/static/tests/unit/components/help/helpTab.test.ts @@ -1,9 +1,9 @@ import Vuex from "vuex"; import { shallowMount } from "@vue/test-utils"; -import { BasicState } from "../../../../src/app/store/basic/state"; +import { BasicState } from "../../../../src/store/basic/state"; import { mockBasicState } from "../../../mocks"; -import HelpTab from "../../../../src/app/components/help/HelpTab.vue"; -import MarkdownPanel from "../../../../src/app/components/help/MarkdownPanel.vue"; +import HelpTab from "../../../../src/components/help/HelpTab.vue"; +import MarkdownPanel from "../../../../src/components/help/MarkdownPanel.vue"; describe("HelpTab", () => { it("renders markdown panel with markdown from state", () => { diff --git a/app/static/tests/unit/components/help/markdownPanel.test.ts b/app/static/tests/unit/components/help/markdownPanel.test.ts index 8f206ffa..6d8e45d6 100644 --- a/app/static/tests/unit/components/help/markdownPanel.test.ts +++ b/app/static/tests/unit/components/help/markdownPanel.test.ts @@ -1,7 +1,7 @@ // Mock imports of third party packages so we can mock their methods before importing component const mockMarkdownItMathjaxPlugin = {}; const mockRenderOutput = "mockRenderOutput"; -const mockRender = jest.fn().mockReturnValue(mockRenderOutput); +const mockRender = vi.fn().mockReturnValue(mockRenderOutput); const mockMarkdownIt = { renderer: { rules: { @@ -10,25 +10,28 @@ const mockMarkdownIt = { }, render: mockRender } as any; -const mockMarkdownItUse = jest.fn().mockReturnValue(mockMarkdownIt); -jest.mock("markdown-it-mathjax", () => ({ __esModule: true, default: () => mockMarkdownItMathjaxPlugin })); +const mockMarkdownItUse = vi.fn().mockReturnValue(mockMarkdownIt); +vi.mock("markdown-it-mathjax", () => ({ __esModule: true, default: () => mockMarkdownItMathjaxPlugin })); -jest.mock("../../../../src/app/components/help/MarkdownItImport.ts", () => { - // mock constructor - this cannot be an arrow function, see - // https://stackoverflow.com/questions/47402005 - // eslint-disable-next-line func-names - return function () { - return { - use: mockMarkdownItUse - }; - }; +vi.mock("../../../../src/components/help/MarkdownItImport.ts", () => { + class MarkDownItClass { + constructor() { + return { + use: mockMarkdownItUse + } + } + }; + return { + default: { + default: MarkDownItClass + } + } }); -/* eslint-disable import/first */ import { shallowMount } from "@vue/test-utils"; import Vuex from "vuex"; -import MarkdownPanel from "../../../../src/app/components/help/MarkdownPanel.vue"; -import { BasicState } from "../../../../src/app/store/basic/state"; +import MarkdownPanel from "../../../../src/components/help/MarkdownPanel.vue"; +import { BasicState } from "../../../../src/store/basic/state"; import { mockBasicState } from "../../../mocks"; describe("MarkdownPanel", () => { @@ -47,10 +50,10 @@ describe("MarkdownPanel", () => { }; afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); - // eslint-disable-next-line @typescript-eslint/ban-types + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type const testImageRewriteRule = (rule: Function, imgSrc: string, expectedOutputSrc: string) => { const tokens = [ { @@ -59,7 +62,7 @@ describe("MarkdownPanel", () => { } ]; const idx = 0; - const mockRenderToken = jest.fn(); + const mockRenderToken = vi.fn(); const slf = { renderToken: mockRenderToken }; @@ -101,7 +104,7 @@ describe("MarkdownPanel", () => { }); it("calls Mathjax.typeset when mounted", () => { - const mockTypeset = jest.fn(); + const mockTypeset = vi.fn(); (window as any).MathJax = { typeset: mockTypeset }; diff --git a/app/static/tests/unit/components/mixins/baseSensitivity.test.ts b/app/static/tests/unit/components/mixins/baseSensitivity.test.ts index 292f6575..e16107fa 100644 --- a/app/static/tests/unit/components/mixins/baseSensitivity.test.ts +++ b/app/static/tests/unit/components/mixins/baseSensitivity.test.ts @@ -1,21 +1,21 @@ import Vuex from "vuex"; -import { ModelState } from "../../../../src/app/store/model/state"; -import baseSensitivity, { BaseSensitivityMixin } from "../../../../src/app/components/mixins/baseSensitivity"; -import { BaseSensitivityState } from "../../../../src/app/store/sensitivity/state"; -import { noSensitivityUpdateRequired } from "../../../../src/app/store/sensitivity/sensitivity"; -import { AppState } from "../../../../src/app/store/appState/state"; -import { BaseSensitivityMutation } from "../../../../src/app/store/sensitivity/mutations"; -import { BaseSensitivityAction } from "../../../../src/app/store/sensitivity/actions"; -import { getters as graphGetters } from "../../../../src/app/store/graphs/getters"; +import { ModelState } from "../../../../src/store/model/state"; +import baseSensitivity, { BaseSensitivityMixin } from "../../../../src/components/mixins/baseSensitivity"; +import { BaseSensitivityState } from "../../../../src/store/sensitivity/state"; +import { noSensitivityUpdateRequired } from "../../../../src/store/sensitivity/sensitivity"; +import { AppState } from "../../../../src/store/appState/state"; +import { BaseSensitivityMutation } from "../../../../src/store/sensitivity/mutations"; +import { BaseSensitivityAction } from "../../../../src/store/sensitivity/actions"; +import { getters as graphGetters } from "../../../../src/store/graphs/getters"; import { mockGraphsState } from "../../../mocks"; -import { defaultGraphSettings } from "../../../../src/app/store/graphs/state"; +import { defaultGraphSettings } from "../../../../src/store/graphs/state"; describe("baseSensitivity mixin", () => { - const mockSensSetUserSummaryDownloadFileName = jest.fn(); - const mockMultiSensSetUserSummaryDownloadFileName = jest.fn(); + const mockSensSetUserSummaryDownloadFileName = vi.fn(); + const mockMultiSensSetUserSummaryDownloadFileName = vi.fn(); - const mockSensDownloadSummary = jest.fn(); - const mockMultiSensDownloadSummary = jest.fn(); + const mockSensDownloadSummary = vi.fn(); + const mockMultiSensDownloadSummary = vi.fn(); const getStore = ( hasRunner = true, @@ -106,7 +106,7 @@ describe("baseSensitivity mixin", () => { }; afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it("sensitivityPrerequisitesReady returns true when all prerequisites have been met", () => { diff --git a/app/static/tests/unit/components/mixins/includeConfiguredTabs.test.ts b/app/static/tests/unit/components/mixins/includeConfiguredTabs.test.ts index 42a581a4..f0722715 100644 --- a/app/static/tests/unit/components/mixins/includeConfiguredTabs.test.ts +++ b/app/static/tests/unit/components/mixins/includeConfiguredTabs.test.ts @@ -1,7 +1,7 @@ import Vuex from "vuex"; -import { BasicState } from "../../../../src/app/store/basic/state"; +import { BasicState } from "../../../../src/store/basic/state"; import { mockBasicState } from "../../../mocks"; -import includeConfiguredTabs from "../../../../src/app/components/mixins/includeConfiguredTabs"; +import includeConfiguredTabs from "../../../../src/components/mixins/includeConfiguredTabs"; describe("includeConfiguredTabs mixin", () => { const getStore = (helpConfig: any, multiSensitivity: boolean | undefined = undefined) => { diff --git a/app/static/tests/unit/components/multiSensitivity/multiSensitivityTab.test.ts b/app/static/tests/unit/components/multiSensitivity/multiSensitivityTab.test.ts index 2a04e8d8..a9830e74 100644 --- a/app/static/tests/unit/components/multiSensitivity/multiSensitivityTab.test.ts +++ b/app/static/tests/unit/components/multiSensitivity/multiSensitivityTab.test.ts @@ -1,18 +1,18 @@ import { shallowMount } from "@vue/test-utils"; import Vuex from "vuex"; -import MultiSensitivityTab from "../../../../src/app/components/multiSensitivity/MultiSensitivityTab.vue"; -import { AppState, AppType } from "../../../../src/app/store/appState/state"; -import LoadingButton from "../../../../src/app/components/LoadingButton.vue"; -import { ModelState } from "../../../../src/app/store/model/state"; -import { MultiSensitivityAction } from "../../../../src/app/store/multiSensitivity/actions"; -import ActionRequiredMessage from "../../../../src/app/components/ActionRequiredMessage.vue"; -import { MultiSensitivityState } from "../../../../src/app/store/multiSensitivity/state"; -import ErrorInfo from "../../../../src/app/components/ErrorInfo.vue"; -import SensitivitySummaryDownload from "../../../../src/app/components/sensitivity/SensitivitySummaryDownload.vue"; -import { getters as graphsGetters } from "../../../../src/app/store/graphs/getters"; +import MultiSensitivityTab from "../../../../src/components/multiSensitivity/MultiSensitivityTab.vue"; +import { AppState, AppType } from "../../../../src/store/appState/state"; +import LoadingButton from "../../../../src/components/LoadingButton.vue"; +import { ModelState } from "../../../../src/store/model/state"; +import { MultiSensitivityAction } from "../../../../src/store/multiSensitivity/actions"; +import ActionRequiredMessage from "../../../../src/components/ActionRequiredMessage.vue"; +import { MultiSensitivityState } from "../../../../src/store/multiSensitivity/state"; +import ErrorInfo from "../../../../src/components/ErrorInfo.vue"; +import SensitivitySummaryDownload from "../../../../src/components/sensitivity/SensitivitySummaryDownload.vue"; +import { getters as graphsGetters } from "../../../../src/store/graphs/getters"; describe("MultiSensitivityTab", () => { - const mockRunMultiSensitivity = jest.fn(); + const mockRunMultiSensitivity = vi.fn(); const getWrapper = ( running = false, @@ -76,7 +76,7 @@ describe("MultiSensitivityTab", () => { }; beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it("renders loading button in loading state when multi-sensitivity is running", () => { diff --git a/app/static/tests/unit/components/run/runPlot.test.ts b/app/static/tests/unit/components/run/runPlot.test.ts index d92eeef6..1aba1241 100644 --- a/app/static/tests/unit/components/run/runPlot.test.ts +++ b/app/static/tests/unit/components/run/runPlot.test.ts @@ -1,19 +1,18 @@ // Mock plotly before import RunTab, which indirectly imports plotly via WodinPlot -jest.mock("plotly.js-basic-dist-min", () => {}); +vi.mock("plotly.js-basic-dist-min", () => ({})); -/* eslint-disable import/first */ -import { shallowMount, VueWrapper } from "@vue/test-utils"; +import { shallowMount } from "@vue/test-utils"; import Vuex from "vuex"; -import RunPlot from "../../../../src/app/components/run/RunPlot.vue"; -import WodinPlot from "../../../../src/app/components/WodinPlot.vue"; -import { BasicState } from "../../../../src/app/store/basic/state"; -import { FitDataGetter } from "../../../../src/app/store/fitData/getters"; -import { getters as runGetters } from "../../../../src/app/store/run/getters"; +import RunPlot from "../../../../src/components/run/RunPlot.vue"; +import WodinPlot from "../../../../src/components/WodinPlot.vue"; +import { BasicState } from "../../../../src/store/basic/state"; +import { FitDataGetter } from "../../../../src/store/fitData/getters"; +import { getters as runGetters } from "../../../../src/store/run/getters"; import { mockGraphsState, mockModelState, mockRunState } from "../../../mocks"; -import { defaultGraphSettings } from "../../../../src/app/store/graphs/state"; +import { defaultGraphSettings } from "../../../../src/store/graphs/state"; describe("RunPlot", () => { - const mockSolution = jest.fn().mockReturnValue({ + const mockSolution = vi.fn().mockReturnValue({ names: ["S", "I"], x: [0, 1], values: [ @@ -28,7 +27,7 @@ describe("RunPlot", () => { error: null } as any; - const mockParamSetSolution1 = jest.fn().mockReturnValue({ + const mockParamSetSolution1 = vi.fn().mockReturnValue({ names: ["S", "I"], x: [0, 1], values: [ @@ -44,7 +43,7 @@ describe("RunPlot", () => { error: null }; - const mockParamSetSolution2 = jest.fn().mockReturnValue({ + const mockParamSetSolution2 = vi.fn().mockReturnValue({ names: ["S", "I"], x: [0, 1], values: [ @@ -60,7 +59,7 @@ describe("RunPlot", () => { error: null }; - const mockParamSetSolution3 = jest.fn().mockReturnValue({ + const mockParamSetSolution3 = vi.fn().mockReturnValue({ names: ["S", "I"], x: [0, 1], values: [ @@ -116,10 +115,10 @@ describe("RunPlot", () => { selectedVariables, unselectedVariables: [], settings: defaultGraphSettings() - }; + } as any; afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it("renders as expected when model has solution", () => { @@ -276,7 +275,7 @@ describe("RunPlot", () => { fadePlot: false, graphIndex: 0, graphConfig - }, + } as any, global: { plugins: [store] } @@ -415,7 +414,7 @@ describe("RunPlot", () => { fadePlot: false, graphConfig, graphIndex: 0 - }, + } as any, global: { plugins: [store] } @@ -445,7 +444,7 @@ describe("RunPlot", () => { props: { fadePlot: true, graphConfig - }, + } as any, global: { plugins: [store] } @@ -505,7 +504,7 @@ describe("RunPlot", () => { props: { fadePlot: false, graphConfig - }, + } as any, global: { plugins: [store] } @@ -589,7 +588,7 @@ describe("RunPlot", () => { props: { fadePlot: true, graphConfig: { ...graphConfig, selectedVariables: [] } - }, + } as any, global: { plugins: [store] } diff --git a/app/static/tests/unit/components/run/runStochasticPlot.test.ts b/app/static/tests/unit/components/run/runStochasticPlot.test.ts index 5d1693a0..8c245f14 100644 --- a/app/static/tests/unit/components/run/runStochasticPlot.test.ts +++ b/app/static/tests/unit/components/run/runStochasticPlot.test.ts @@ -1,18 +1,17 @@ // Mock plotly before import RunStochasticTab, which indirectly imports plotly via WodinPlot -jest.mock("plotly.js-basic-dist-min", () => {}); +vi.mock("plotly.js-basic-dist-min", () => ({})); -/* eslint-disable import/first */ import { shallowMount } from "@vue/test-utils"; import Vuex from "vuex"; -import RunStochasticPlot from "../../../../src/app/components/run/RunStochasticPlot.vue"; -import WodinPlot from "../../../../src/app/components/WodinPlot.vue"; -import { StochasticState } from "../../../../src/app/store/stochastic/state"; -import RunPlot from "../../../../src/app/components/run/RunPlot.vue"; +import RunStochasticPlot from "../../../../src/components/run/RunStochasticPlot.vue"; +import WodinPlot from "../../../../src/components/WodinPlot.vue"; +import { StochasticState } from "../../../../src/store/stochastic/state"; +import RunPlot from "../../../../src/components/run/RunPlot.vue"; import { mockGraphsState, mockModelState, mockRunState } from "../../../mocks"; -import { defaultGraphSettings } from "../../../../src/app/store/graphs/state"; +import { defaultGraphSettings } from "../../../../src/store/graphs/state"; describe("RunPlot for stochastic", () => { - const mockSolution = jest.fn().mockReturnValue({ + const mockSolution = vi.fn().mockReturnValue({ x: [0, 1], values: [ { description: "Individual", name: "S", y: [10, 20] }, @@ -48,12 +47,12 @@ describe("RunPlot for stochastic", () => { selectedVariables, unselectedVariables: [], settings: defaultGraphSettings() - }; + } as any; const linkedXAxis = { autorange: false, range: [1, 2] }; afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it("renders as expected when model has stochastic result", () => { @@ -95,7 +94,7 @@ describe("RunPlot for stochastic", () => { // Generates expected plot data from model const plotData = wodinPlot.props("plotData"); - const data = plotData(); + const data = plotData(0, 0, 0); expect(data).toStrictEqual([ { mode: "lines", @@ -174,7 +173,7 @@ describe("RunPlot for stochastic", () => { fadePlot: false, graphIndex: 0, graphConfig - }, + } as any, global: { plugins: [store] } @@ -188,7 +187,7 @@ describe("RunPlot for stochastic", () => { expect(wodinPlot.props("graphConfig")).toStrictEqual(graphConfig); const plotData = wodinPlot.props("plotData"); - const data = plotData(); + const data = plotData(0, 0, 0); expect(data).toStrictEqual([]); }); @@ -211,7 +210,7 @@ describe("RunPlot for stochastic", () => { props: { fadePlot: false, graphConfig - }, + } as any, global: { plugins: [store] } @@ -219,7 +218,7 @@ describe("RunPlot for stochastic", () => { const wodinPlot = wrapper.findComponent(WodinPlot); // Generates expected empty plot data from solution const plotData = wodinPlot.props("plotData"); - const data = plotData(); + const data = plotData(0, 0, 0); expect(data).toStrictEqual([]); }); @@ -235,7 +234,7 @@ describe("RunPlot for stochastic", () => { props: { fadePlot: true, graphConfig - }, + } as any, global: { plugins: [store] } @@ -260,14 +259,14 @@ describe("RunPlot for stochastic", () => { props: { fadePlot: false, graphConfig - }, + } as any, global: { plugins: [store] } }); const wodinPlot = wrapper.findComponent(WodinPlot); const plotData = wodinPlot.props("plotData"); - const data = plotData(); + const data = plotData(0, 0, 0); expect(data).toStrictEqual([ { mode: "lines", diff --git a/app/static/tests/unit/components/run/runTab.test.ts b/app/static/tests/unit/components/run/runTab.test.ts index 1bcab6ff..a43d8d2d 100644 --- a/app/static/tests/unit/components/run/runTab.test.ts +++ b/app/static/tests/unit/components/run/runTab.test.ts @@ -1,13 +1,12 @@ // Mock plotly before import RunTab, which indirectly imports plotly via RunPlot import VueFeather from "vue-feather"; -jest.mock("plotly.js-basic-dist-min", () => {}); +vi.mock("plotly.js-basic-dist-min", () => ({})); -/* eslint-disable import/first */ import Vuex from "vuex"; import { shallowMount } from "@vue/test-utils"; import { nextTick } from "vue"; -import { BasicState } from "../../../../src/app/store/basic/state"; +import { BasicState } from "../../../../src/store/basic/state"; import { mockBasicState, mockFitState, @@ -17,24 +16,24 @@ import { mockRunState, mockStochasticState } from "../../../mocks"; -import { ModelState } from "../../../../src/app/store/model/state"; -import { RunState } from "../../../../src/app/store/run/state"; -import RunTab from "../../../../src/app/components/run/RunTab.vue"; -import RunPlot from "../../../../src/app/components/run/RunPlot.vue"; -import RunStochasticPlot from "../../../../src/app/components/run/RunStochasticPlot.vue"; -import ErrorInfo from "../../../../src/app/components/ErrorInfo.vue"; -import ActionRequiredMessage from "../../../../src/app/components/ActionRequiredMessage.vue"; -import DownloadOutput from "../../../../src/app/components/DownloadOutput.vue"; -import LoadingSpinner from "../../../../src/app/components/LoadingSpinner.vue"; -import { StochasticState } from "../../../../src/app/store/stochastic/state"; -import { OdinRunnerDiscrete } from "../../../../src/app/types/responseTypes"; -import { OdinRunResultDiscrete } from "../../../../src/app/types/wrapperTypes"; -import { ModelGetter } from "../../../../src/app/store/model/getters"; -import { AppType } from "../../../../src/app/store/appState/state"; -import { RunMutation } from "../../../../src/app/store/run/mutations"; -import { RunAction } from "../../../../src/app/store/run/actions"; -import { getters as graphGetters } from "../../../../src/app/store/graphs/getters"; -import { FitState } from "../../../../src/app/store/fit/state"; +import { ModelState } from "../../../../src/store/model/state"; +import { RunState } from "../../../../src/store/run/state"; +import RunTab from "../../../../src/components/run/RunTab.vue"; +import RunPlot from "../../../../src/components/run/RunPlot.vue"; +import RunStochasticPlot from "../../../../src/components/run/RunStochasticPlot.vue"; +import ErrorInfo from "../../../../src/components/ErrorInfo.vue"; +import ActionRequiredMessage from "../../../../src/components/ActionRequiredMessage.vue"; +import DownloadOutput from "../../../../src/components/DownloadOutput.vue"; +import LoadingSpinner from "../../../../src/components/LoadingSpinner.vue"; +import { StochasticState } from "../../../../src/store/stochastic/state"; +import { OdinRunnerDiscrete } from "../../../../src/types/responseTypes"; +import { OdinRunResultDiscrete } from "../../../../src/types/wrapperTypes"; +import { ModelGetter } from "../../../../src/store/model/getters"; +import { AppType } from "../../../../src/store/appState/state"; +import { RunMutation } from "../../../../src/store/run/mutations"; +import { RunAction } from "../../../../src/store/run/actions"; +import { getters as graphGetters } from "../../../../src/store/graphs/getters"; +import { FitState } from "../../../../src/store/fit/state"; describe("RunTab", () => { const defaultModelState = { @@ -54,12 +53,12 @@ describe("RunTab", () => { }; beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); - const mockRunModel = jest.fn(); - const mockDownloadOutput = jest.fn(); - const mockSetUserDownloadFileName = jest.fn(); + const mockRunModel = vi.fn(); + const mockDownloadOutput = vi.fn(); + const mockSetUserDownloadFileName = vi.fn(); const getWrapper = ( modelState: Partial = defaultModelState, @@ -243,7 +242,7 @@ describe("RunTab", () => { const wrapper = getStochasticWrapper( {}, { - solution: jest.fn() + solution: vi.fn() } ); const plots = wrapper.findAllComponents(RunStochasticPlot); @@ -305,7 +304,7 @@ describe("RunTab", () => { expect((wrapper.find("button#download-btn").element as HTMLButtonElement).disabled).toBe(false); }); - it("disables download button when run is required ", () => { + it("disables download button when run is required", () => { const runState = { result: { solution: {} } as any, runRequired: { modelChanged: true } as any diff --git a/app/static/tests/unit/components/run/support.test.ts b/app/static/tests/unit/components/run/support.test.ts index 64b5870e..7e52f81e 100644 --- a/app/static/tests/unit/components/run/support.test.ts +++ b/app/static/tests/unit/components/run/support.test.ts @@ -1,4 +1,4 @@ -import { runRequiredExplanation } from "../../../../src/app/components/run/support"; +import { runRequiredExplanation } from "../../../../src/components/run/support"; describe("construct actionable fit update messages from fit state changes", () => { const base = {