Skip to content
Snippets Groups Projects
Commit 43354983 authored by Atte Keinänen's avatar Atte Keinänen
Browse files

Fix alerts integration tests

parent 84907117
No related branches found
No related tags found
No related merge requests found
...@@ -252,6 +252,7 @@ export default class Question { ...@@ -252,6 +252,7 @@ export default class Question {
const vizSettings = visualizationSettings const vizSettings = visualizationSettings
? visualizationSettings ? visualizationSettings
: this.card().visualization_settings; : this.card().visualization_settings;
const goalEnabled = vizSettings["graph.show_goal"]; const goalEnabled = vizSettings["graph.show_goal"];
const hasSingleYAxisColumn = vizSettings["graph.metrics"] && const hasSingleYAxisColumn = vizSettings["graph.metrics"] &&
vizSettings["graph.metrics"].length === 1; vizSettings["graph.metrics"].length === 1;
......
...@@ -679,7 +679,7 @@ export const apiUpdateQuestion = (question) => { ...@@ -679,7 +679,7 @@ export const apiUpdateQuestion = (question) => {
await dispatch(fetchAlertsForQuestion(updatedQuestion.id())) await dispatch(fetchAlertsForQuestion(updatedQuestion.id()))
// remove the databases in the store that are used to populate the QB databases list. // remove the databases in the store that are used to populate the QB databases list.
// This is done when saving a Card because the newly saved card will be elligable for use as a source query // This is done when saving a Card because the newly saved card will be eligible for use as a source query
// so we want the databases list to be re-fetched next time we hit "New Question" so it shows up // so we want the databases list to be re-fetched next time we hit "New Question" so it shows up
dispatch(clearRequestState({ statePath: ["metadata", "databases"] })); dispatch(clearRequestState({ statePath: ["metadata", "databases"] }));
......
...@@ -99,6 +99,10 @@ describe("Alerts", () => { ...@@ -99,6 +99,10 @@ describe("Alerts", () => {
.addBreakout(["datetime-field", ["field-id", 1], "day"]) .addBreakout(["datetime-field", ["field-id", 1], "day"])
.question() .question()
.setDisplay("line") .setDisplay("line")
.setVisualizationSettings({
"graph.dimensions": ["CREATED_AT"],
"graph.metrics": ["count"]
})
.setDisplayName("Time series line") .setDisplayName("Time series line")
) )
...@@ -109,7 +113,12 @@ describe("Alerts", () => { ...@@ -109,7 +113,12 @@ describe("Alerts", () => {
.addBreakout(["datetime-field", ["field-id", 1], "day"]) .addBreakout(["datetime-field", ["field-id", 1], "day"])
.question() .question()
.setDisplay("line") .setDisplay("line")
.setVisualizationSettings({ "graph.show_goal": true, "graph.goal_value": 10 }) .setVisualizationSettings({
"graph.show_goal": true,
"graph.goal_value": 10,
"graph.dimensions": ["CREATED_AT"],
"graph.metrics": ["count"]
})
.setDisplayName("Time series line with goal") .setDisplayName("Time series line with goal")
) )
...@@ -317,7 +326,6 @@ describe("Alerts", () => { ...@@ -317,7 +326,6 @@ describe("Alerts", () => {
// as a recipient. // as a recipient.
useSharedAdminLogin() useSharedAdminLogin()
const adminUser = await UserApi.current(); const adminUser = await UserApi.current();
// TODO TODO TODO THIS ALERT HAZ A COMP-LETELY WRONG TYPE!
await AlertApi.create(getDefaultAlert(timeSeriesWithGoalQuestion, adminUser)) await AlertApi.create(getDefaultAlert(timeSeriesWithGoalQuestion, adminUser))
useSharedNormalLogin() useSharedNormalLogin()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment