Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Jun 26, 2024
1 parent 5fdf149 commit 521911d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
3 changes: 2 additions & 1 deletion app/static/src/app/components/code/SelectedVariables.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ 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
2 changes: 1 addition & 1 deletion app/static/src/app/store/graphs/actions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ActionTree } from "vuex";
import { GraphsMutation } from "./mutations";
import { AppState, AppType } from "../appState/state";
import { FitDataAction } from "../fitData/actions";
import { GraphsState } from "./state";
import { ActionTree } from "vuex";

export enum GraphsAction {
UpdateSelectedVariables = "UpdateSelectedVariables"
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/graphs/getters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GraphsState} from "./state";
import {Getter, GetterTree} from "vuex";
import {GraphsState} from "./state";
import {AppState} from "../appState/state";

export enum GraphsGetter {
Expand Down
1 change: 0 additions & 1 deletion app/static/src/app/store/graphs/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MutationTree } from "vuex";
import { YAxisRange, GraphsState } from "./state";
import { ModelState } from "../model/state";

export enum GraphsMutation {
SetLogScaleYAxis = "SetLogScaleYAxis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ describe("SelectedVariables", () => {
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 () => {
Expand Down
6 changes: 4 additions & 2 deletions app/static/tests/unit/store/fitData/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ describe("Fit Data actions", () => {
};

const payload = { column: "a", variable: "I" };
(actions[FitDataAction.UpdateLinkedVariable] as any)({ commit, dispatch, state: testState, rootGetters }, payload);
(actions[FitDataAction.UpdateLinkedVariable] as any)(
{ commit, dispatch, state: testState, rootGetters }, payload);
expect(commit).toHaveBeenCalledTimes(2);
expect(commit.mock.calls[0][0]).toBe(FitDataMutation.SetLinkedVariable);
expect(commit.mock.calls[0][1]).toBe(payload);
Expand All @@ -388,7 +389,8 @@ describe("Fit Data actions", () => {
};

const payload = { column: "b", variable: "I" };
(actions[FitDataAction.UpdateLinkedVariable] as any)({ commit, dispatch, state: testState, rootGetters }, payload);
(actions[FitDataAction.UpdateLinkedVariable] as any)(
{ commit, dispatch, state: testState, rootGetters }, payload);
expect(commit).toHaveBeenCalledTimes(1);
expect(commit.mock.calls[0][0]).toBe(FitDataMutation.SetLinkedVariable);
expect(commit.mock.calls[0][1]).toBe(payload);
Expand Down
6 changes: 4 additions & 2 deletions app/static/tests/unit/store/graphs/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ describe("Graphs actions", () => {
);
expect(commit).toHaveBeenCalledTimes(1);
expect(commit.mock.calls[0][0]).toBe(GraphsMutation.SetSelectedVariables);
expect(commit.mock.calls[0][1]).toStrictEqual({index: 1, selectedVariables: ["a", "b"], unselectedVariables: ["c"]});
expect(commit.mock.calls[0][1]).toStrictEqual(
{index: 1, selectedVariables: ["a", "b"], unselectedVariables: ["c"]});
expect(dispatch).not.toHaveBeenCalled();
});

Expand All @@ -61,7 +62,8 @@ describe("Graphs actions", () => {
);
expect(commit).toHaveBeenCalledTimes(1);
expect(commit.mock.calls[0][0]).toBe(GraphsMutation.SetSelectedVariables);
expect(commit.mock.calls[0][1]).toStrictEqual({index: 1, selectedVariables: ["a", "b"], unselectedVariables: ["c"]});
expect(commit.mock.calls[0][1]).toStrictEqual(
{index: 1, selectedVariables: ["a", "b"], unselectedVariables: ["c"]});
expect(dispatch).toHaveBeenCalledTimes(1);
expect(dispatch.mock.calls[0][0]).toBe(`fitData/${FitDataAction.UpdateLinkedVariables}`);
expect(dispatch.mock.calls[0][1]).toBe(null);
Expand Down
3 changes: 2 additions & 1 deletion app/static/tests/unit/store/graphs/mutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ describe("Graphs mutations", () => {
{ selectedVariables: [], unselectedVariables: [] }
]
});
mutations.SetSelectedVariables(testState, {index: 1, selectedVariables: ["x", "z"], unselectedVariables: ["y"]});
mutations.SetSelectedVariables(testState,
{index: 1, selectedVariables: ["x", "z"], unselectedVariables: ["y"]});
expect(testState.config[1]).toStrictEqual({selectedVariables: ["x", "z"], unselectedVariables: ["y"]});
expect(testState.config[0]).toStrictEqual({ selectedVariables: [], unselectedVariables: [] });
});
Expand Down

0 comments on commit 521911d

Please sign in to comment.