Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
r-ash committed Nov 26, 2024
1 parent b5ebd68 commit 39fbb12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ describe("Model Output page", () => {
const wrapper = getWrapper(store);

const plotTabs = wrapper.findAll(".nav-link");
expect(plotTabs.length).toBe(5);
expect(plotTabs.length).toBe(6);
expect(plotTabs[0].classes()).contains("active");
expect(plotTabs[1].classes()).not.contains("active");
expect(plotTabs[2].classes()).not.contains("active");
expect(plotTabs[3].classes()).not.contains("active");
expect(plotTabs[4].classes()).not.contains("active");
expect(plotTabs[5].classes()).not.contains("active");
expect(wrapper.findComponent(PlotControlSet).exists()).toBeTruthy();
expect(wrapper.findComponent(FilterSet).exists()).toBeTruthy();
expect(wrapper.findComponent(Choropleth).exists()).toBeTruthy();
Expand Down
20 changes: 14 additions & 6 deletions src/app/static/src/tests/modelCalibrate/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe("ModelCalibrate actions", () => {

await actions.getResult({commit, state, rootState, dispatch} as any);

expect(commit.mock.calls.length).toBe(9);
expect(commit.mock.calls.length).toBe(10);
expect(commit.mock.calls[0][0]).toStrictEqual({
type: "MetadataFetched",
payload: testResult
Expand Down Expand Up @@ -230,28 +230,36 @@ describe("ModelCalibrate actions", () => {
filters: []
}
});
expect(commit.mock.calls[5][0]).toBe("plotSelections/updatePlotSelection");
expect(commit.mock.calls[5][1]["payload"]).toStrictEqual({
plot: "cascade",
selections: {
controls: [],
filters: []
}
});

// Commits initial scale selections
expect(commit.mock.calls[5][0]).toStrictEqual({
expect(commit.mock.calls[6][0]).toStrictEqual({
type: "plotState/setOutputScale",
payload: {
scale: Scale.Colour,
selections: {}
}
});
expect(commit.mock.calls[6][0]).toStrictEqual({
expect(commit.mock.calls[7][0]).toStrictEqual({
type: "plotState/setOutputScale",
payload: {
scale: Scale.Size,
selections: {}
}
});

expect(commit.mock.calls[7][0]).toBe("Calibrated");
expect(commit.mock.calls[8][0]).toBe("Ready");
expect(commit.mock.calls[8][0]).toBe("Calibrated");
expect(commit.mock.calls[9][0]).toBe("Ready");

// Dispatches to get plot data
expect(getOutputFilteredDataSpy.mock.calls.length).toBe(4) // The number of plots we have
expect(getOutputFilteredDataSpy.mock.calls.length).toBe(5) // The number of plots we have
expect(dispatch.mock.calls[0][0]).toBe("getCalibratePlot");
expect(dispatch.mock.calls[1][0]).toBe("getComparisonPlot");
});
Expand Down

0 comments on commit 39fbb12

Please sign in to comment.