Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Jun 26, 2024
1 parent 521911d commit 90c9c08
Show file tree
Hide file tree
Showing 27 changed files with 97 additions and 97 deletions.
8 changes: 5 additions & 3 deletions app/static/src/app/components/code/SelectedVariables.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script lang="ts">
import { computed, defineComponent } from "vue";
import { useStore } from "vuex";
import {GraphsAction} from "../../store/graphs/actions";
import { GraphsAction } from "../../store/graphs/actions";
export default defineComponent({
name: "SelectedVariables",
Expand All @@ -38,8 +38,10 @@ export default defineComponent({
};
const updateSelectedVariables = (newVariables: string[]) => {
store.dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`,
{index: 0, selectedVariables: newVariables});
store.dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`, {
index: 0,
selectedVariables: newVariables
});
};
const toggleVariable = (variable: string) => {
Expand Down
4 changes: 2 additions & 2 deletions app/static/src/app/components/mixins/baseSensitivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { sensitivityUpdateRequiredExplanation, verifyValidPlotSettingsTime } fro
import { Dict } from "../../types/utilTypes";
import { BaseSensitivityMutation } from "../../store/sensitivity/mutations";
import { BaseSensitivityAction } from "../../store/sensitivity/actions";
import {GraphsGetter} from "../../store/graphs/getters";
import { GraphsGetter } from "../../store/graphs/getters";

export interface BaseSensitivityMixin {
sensitivityPrerequisitesReady: ComputedRef<boolean>;
Expand All @@ -23,7 +23,7 @@ export default (store: Store<AppState>, multiSensitivity: boolean): BaseSensitiv
const namespace = multiSensitivity ? "multiSensitivity" : "sensitivity";

const hasRunner = computed(() => store.getters[`model/${ModelGetter.hasRunner}`]);
const allSelectedVariables = computed(() => store.getters[`graphs/${GraphsGetter.allSelectedVariables}`]);
const allSelectedVariables = computed(() => store.getters[`graphs/${GraphsGetter.allSelectedVariables}`]);

const sensitivityPrerequisitesReady = computed(() => {
return hasRunner.value && !!store.state.model.odin && !store.state.model.compileRequired;
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/components/options/LinkData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useStore } from "vuex";
import { FitDataGetter } from "../../store/fitData/getters";
import userMessages from "../../userMessages";
import { FitDataAction } from "../../store/fitData/actions";
import {GraphsGetter} from "../../store/graphs/getters";
import { GraphsGetter } from "../../store/graphs/getters";
export default defineComponent({
name: "LinkData",
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/components/run/RunTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import LoadingSpinner from "../LoadingSpinner.vue";
import { AppType } from "../../store/appState/state";
import { ModelGetter } from "../../store/model/getters";
import RunStochasticPlot from "./RunStochasticPlot.vue";
import {GraphsGetter} from "../../store/graphs/getters";
import { GraphsGetter } from "../../store/graphs/getters";
export default defineComponent({
name: "RunTab",
Expand Down
4 changes: 2 additions & 2 deletions app/static/src/app/excel/wodinModelOutputDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FitData } from "../store/fitData/state";
import { AppType } from "../store/appState/state";
import { FitState } from "../store/fit/state";
import { FitDataGetter } from "../store/fitData/getters";
import {GraphsGetter} from "../store/graphs/getters";
import { GraphsGetter } from "../store/graphs/getters";

export class WodinModelOutputDownload extends WodinExcelDownload {
private readonly _points: number;
Expand Down Expand Up @@ -47,7 +47,7 @@ export class WodinModelOutputDownload extends WodinExcelDownload {
nPoints: this._points
});
const selectedVariables = this._rootGetters[`graphs/${GraphsGetter.allSelectedVariables}`];
console.log(`selectedVariables are ${JSON.stringify(selectedVariables)}`)
console.log(`selectedVariables are ${JSON.stringify(selectedVariables)}`);

const worksheet = WodinModelOutputDownload._generateModelledOutput(
selectedVariables,
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/serialise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SerialisedModelFitState,
SerialisedMultiSensitivityState
} from "./types/serialisationTypes";
import { GraphsState} from "./store/graphs/state";
import { GraphsState } from "./store/graphs/state";
import { Dict } from "./types/utilTypes";
import { MultiSensitivityState } from "./store/multiSensitivity/state";

Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/fitData/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RunMutation } from "../run/mutations";
import { ModelFitMutation } from "../modelFit/mutations";
import { ModelFitAction } from "../modelFit/actions";
import { SensitivityMutation } from "../sensitivity/mutations";
import {GraphsGetter} from "../graphs/getters";
import { GraphsGetter } from "../graphs/getters";

export enum FitDataAction {
Upload = "Upload",
Expand Down
10 changes: 5 additions & 5 deletions app/static/src/app/store/graphs/getters.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Getter, GetterTree} from "vuex";
import {GraphsState} from "./state";
import {AppState} from "../appState/state";
import { Getter, GetterTree } from "vuex";
import { GraphsState } from "./state";
import { AppState } from "../appState/state";

export enum GraphsGetter {
allSelectedVariables= "allSelectedVariables"
allSelectedVariables = "allSelectedVariables"
}

export interface GraphsGetters {
[GraphsGetter.allSelectedVariables]: Getter<GraphsState, AppState>
[GraphsGetter.allSelectedVariables]: Getter<GraphsState, AppState>;
}

export const getters: GraphsGetters & GetterTree<GraphsState, AppState> = {
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/model/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const compileModelAndUpdateStore = (context: ActionContext<ModelState, AppState>

// Retain variable selections. Newly added variables will be selected by default in the first graph
const selectedVariables = variables.filter((s) => !rootState.graphs.config[0].unselectedVariables.includes(s));
dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`, { index: 0, selectedVariables }, { root: true});
dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`, { index: 0, selectedVariables }, { root: true });

if (state.compileRequired) {
commit(ModelMutation.SetCompileRequired, false);
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/types/serialisationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { VisualisationTab } from "../store/appState/state";
import { CodeState } from "../store/code/state";
import { FitDataState } from "../store/fitData/state";
import { Palette } from "../palette";
import { GraphsState} from "../store/graphs/state";
import { GraphsState } from "../store/graphs/state";
import { Dict } from "./utilTypes";

export interface SerialisedRunResult {
Expand Down
20 changes: 12 additions & 8 deletions app/static/tests/unit/components/code/selectedVariables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { shallowMount } from "@vue/test-utils";
import { BasicState } from "../../../../src/app/store/basic/state";
import SelectedVariables from "../../../../src/app/components/code/SelectedVariables.vue";
import { ModelAction } from "../../../../src/app/store/model/actions";
import {GraphsAction} from "../../../../src/app/store/graphs/actions";
import { GraphsAction } from "../../../../src/app/store/graphs/actions";

describe("SelectedVariables", () => {
const mockUpdateSelectedVariables = jest.fn();
Expand All @@ -17,7 +17,7 @@ describe("SelectedVariables", () => {
state: {
config: [
{
selectedVariables: ["S", "R"],
selectedVariables: ["S", "R"]
}
]
},
Expand Down Expand Up @@ -73,30 +73,34 @@ describe("SelectedVariables", () => {
const s = wrapper.findAll(".selected-variables-panel span.variable").at(0)!;
await s.trigger("click");
expect(mockUpdateSelectedVariables).toBeCalledTimes(1);
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({index: 0, selectedVariables: ["R"]});
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({ index: 0, selectedVariables: ["R"] });
});

it("clicking an unselected variables selects it", async () => {
const wrapper = getWrapper();
const i = wrapper.findAll(".selected-variables-panel span.variable").at(1)!;
await i.trigger("click");
expect(mockUpdateSelectedVariables).toBeCalledTimes(1);
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual(
{index: 0, selectedVariables: ["S", "R", "I"]});
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({
index: 0,
selectedVariables: ["S", "R", "I"]
});
});

it("clicking select all link selects all variables", async () => {
const wrapper = getWrapper();
wrapper.find("span#select-variables-all").trigger("click");
expect(mockUpdateSelectedVariables).toBeCalledTimes(1);
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual(
{index: 0, selectedVariables: ["S", "I", "R"]});
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({
index: 0,
selectedVariables: ["S", "I", "R"]
});
});

it("clicking select none link unselects all variables", async () => {
const wrapper = getWrapper();
wrapper.find("span#select-variables-none").trigger("click");
expect(mockUpdateSelectedVariables).toBeCalledTimes(1);
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({index: 0, selectedVariables: []});
expect(mockUpdateSelectedVariables.mock.calls[0][1]).toStrictEqual({ index: 0, selectedVariables: [] });
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BaseSensitivityMutation } from "../../../../src/app/store/sensitivity/m
import { BaseSensitivityAction } from "../../../../src/app/store/sensitivity/actions";
import { getters as graphGetters } from "../../../../src/app/store/graphs/getters";
import mock = jest.mock;
import {mockGraphsState} from "../../../mocks";
import { mockGraphsState } from "../../../mocks";

describe("baseSensitivity mixin", () => {
const mockSensSetUserSummaryDownloadFileName = jest.fn();
Expand All @@ -30,7 +30,7 @@ describe("baseSensitivity mixin", () => {
graphs: {
namespaced: true,
state: mockGraphsState({
config: [ { selectedVariables, unselectedVariables: [] } ]
config: [{ selectedVariables, unselectedVariables: [] }]
}),
getters: graphGetters
},
Expand Down Expand Up @@ -132,7 +132,7 @@ describe("baseSensitivity mixin", () => {
sensState: Partial<BaseSensitivityState>,
selectedVariables: string[],
expectedSensMsg: string,
expectedMultiSensMsg: string,
expectedMultiSensMsg: string
) => {
const sensStore = getStore(hasRunner, modelState, sensState, {}, selectedVariables);
const sensSut = baseSensitivity(sensStore, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ActionRequiredMessage from "../../../../src/app/components/ActionRequired
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 { getters as graphsGetters } from "../../../../src/app/store/graphs/getters";

describe("MultiSensitivityTab", () => {
const mockRunMultiSensitivity = jest.fn();
Expand Down
6 changes: 3 additions & 3 deletions app/static/tests/unit/components/options/linkData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Vuex from "vuex";
import LinkData from "../../../../src/app/components/options/LinkData.vue";
import { FitState } from "../../../../src/app/store/fit/state";
import { getters } from "../../../../src/app/store/fitData/getters";
import {mockFitDataState, mockFitState, mockGraphsState, mockModelState} from "../../../mocks";
import { mockFitDataState, mockFitState, mockGraphsState, mockModelState } from "../../../mocks";
import { FitDataAction } from "../../../../src/app/store/fitData/actions";
import { getters as graphGetters } from "../../../../src/app/store/graphs/getters";

Expand Down Expand Up @@ -32,8 +32,8 @@ describe("LinkData", () => {
},
graphs: {
namespaced: true,
state: mockGraphsState({
config: [ { selectedVariables: ["I", "R"], unselectedVariables: [] } ]
state: mockGraphsState({
config: [{ selectedVariables: ["I", "R"], unselectedVariables: [] }]
}),
getters: graphGetters
},
Expand Down
6 changes: 3 additions & 3 deletions app/static/tests/unit/components/run/runPlot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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 {mockBasicState, mockGraphsState, mockRunState} from "../../../mocks";
import { mockBasicState, mockGraphsState, mockRunState } from "../../../mocks";

describe("RunPlot", () => {
const mockSolution = jest.fn().mockReturnValue({
Expand Down Expand Up @@ -84,7 +84,7 @@ describe("RunPlot", () => {
const selectedVariables = ["S", "I"];

const graphsState = {
config: [ { selectedVariables, unselectedVariables: [] } ]
config: [{ selectedVariables, unselectedVariables: [] }]
};

afterEach(() => {
Expand Down Expand Up @@ -522,7 +522,7 @@ describe("RunPlot", () => {
const store = new Vuex.Store<BasicState>({
state: {
graphs: mockGraphsState({
config: [ { selectedVariables: [] } ]
config: [{ selectedVariables: [] }]
} as any),
run: mockRunState()
} as any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RunStochasticPlot from "../../../../src/app/components/run/RunStochasticP
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 {mockGraphsState, mockModelState, mockRunState} from "../../../mocks";
import { mockGraphsState, mockModelState, mockRunState } from "../../../mocks";

describe("RunPlot for stochastic", () => {
const mockSolution = jest.fn().mockReturnValue({
Expand All @@ -32,7 +32,7 @@ describe("RunPlot for stochastic", () => {

const selectedVariables = ["S", "I", "R"];

const graphsState = mockGraphsState( { config: [ { selectedVariables, unselectedVariables: [] } ] } );
const graphsState = mockGraphsState({ config: [{ selectedVariables, unselectedVariables: [] }] });

afterEach(() => {
jest.clearAllMocks();
Expand Down
8 changes: 4 additions & 4 deletions app/static/tests/unit/components/run/runTab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Vuex from "vuex";
import { shallowMount } from "@vue/test-utils";
import { nextTick } from "vue";
import { BasicState } from "../../../../src/app/store/basic/state";
import {mockBasicState, mockGraphsState, mockModelState, mockRunState, mockStochasticState} from "../../../mocks";
import { mockBasicState, mockGraphsState, mockModelState, 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";
Expand Down Expand Up @@ -65,7 +65,7 @@ describe("RunTab", () => {
graphs: {
namespaced: true,
state: mockGraphsState({
config: [ { selectedVariables, unselectedVariables: [] } ]
config: [{ selectedVariables, unselectedVariables: [] }]
}),
getters: graphGetters
},
Expand Down Expand Up @@ -108,7 +108,7 @@ describe("RunTab", () => {
graphs: {
namespaced: true,
state: mockGraphsState({
config: [ { selectedVariables: ["S"], unselectedVariables: [] } ]
config: [{ selectedVariables: ["S"], unselectedVariables: [] }]
}),
getters: graphGetters
},
Expand Down Expand Up @@ -243,7 +243,7 @@ describe("RunTab", () => {
});

it("fades plot and show message when no selected variables", () => {
const wrapper = getWrapper( defaultModelState, defaultRunState, true, AppType.Basic, []);
const wrapper = getWrapper(defaultModelState, defaultRunState, true, AppType.Basic, []);
expect(wrapper.findComponent(ActionRequiredMessage).props("message")).toBe(
"Please select at least one variable."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { BaseSensitivityMutation, SensitivityMutation } from "../../../../src/ap
import LoadingSpinner from "../../../../src/app/components/LoadingSpinner.vue";
import { ModelGetter } from "../../../../src/app/store/model/getters";
import { getters as graphsGetters } from "../../../../src/app/store/graphs/getters";
import {mockGraphsState} from "../../../mocks";
import { mockGraphsState } from "../../../mocks";

describe("SensitivitySummaryDownload", () => {
const mockSetUserSummaryDownloadFileName = jest.fn();
Expand Down Expand Up @@ -86,7 +86,8 @@ describe("SensitivitySummaryDownload", () => {
state: mockGraphsState({
config: [
{
selectedVariables: ["S"], unselectedVariables: []
selectedVariables: ["S"],
unselectedVariables: []
}
]
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ describe("SensitivitySummaryPlot", () => {
namespaced: true,
state: {
settings: { logScaleYAxis },
config: [
{ selectedVariables }
]
config: [{ selectedVariables }]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import LoadingSpinner from "../../../../src/app/components/LoadingSpinner.vue";
import { SensitivityMutation } from "../../../../src/app/store/sensitivity/mutations";
import SensitivitySummaryDownload from "../../../../src/app/components/sensitivity/SensitivitySummaryDownload.vue";
import LoadingButton from "../../../../src/app/components/LoadingButton.vue";
import { getters as graphsGetters} from "../../../../src/app/store/graphs/getters";
import { getters as graphsGetters } from "../../../../src/app/store/graphs/getters";

jest.mock("plotly.js-basic-dist-min", () => {});

Expand Down Expand Up @@ -235,14 +235,7 @@ describe("SensitivityTab", () => {
}
}
} as any;
const wrapper = getWrapper(
AppType.Basic,
{},
sensitivityState,
{},
true,
[]
);
const wrapper = getWrapper(AppType.Basic, {}, sensitivityState, {}, true, []);
expect(wrapper.findComponent(ActionRequiredMessage).props("message")).toBe(
"Please select at least one variable."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,7 @@ describe("SensitivityTracesPlot", () => {
paletteModel: mockPalette
},
graphs: {
config: [
{ selectedVariables: hasSelectedVariables ? selectedVariables : [] }
]
config: [{ selectedVariables: hasSelectedVariables ? selectedVariables : [] }]
}
} as any,
modules: {
Expand Down
Loading

0 comments on commit 90c9c08

Please sign in to comment.