Commit b001a6b2 authored by oleg.pahhomov's avatar oleg.pahhomov

SA0140-537 | Add validation for widgets in the test

parent cdc02155
......@@ -35,19 +35,18 @@ public class DashboardWidgetController_SavePreferences_Test extends DashboardWid
ResponseEntity<Response<UserWidgetDto>> response = updatePreferences(USER_REGULAR, DASHBOARD_1, accommodationId, preferences(widget));
assertEquals(HttpStatus.OK, response.getStatusCode());
WidgetResponse userWidget1 = getWidget(DASHBOARD_1, accommodationId, Language.ET, GraphTypeEnum.line, USER_REGULAR);
UserWidgetDto preferences = userWidget1.getPreferences();
WidgetResponse userWidget = getWidget(DASHBOARD_1, accommodationId, Language.ET, GraphTypeEnum.line, USER_REGULAR);
UserWidgetDto preferences = userWidget.getPreferences();
assertNotNull(preferences);
list_size(preferences.getGraphs(), 1);
UserGraphTypeDto graphTypeDto = preferences.getGraphs().get(0);
assertEquals(GraphTypeEnum.line, graphTypeDto.getGraphType());
list_size(graphTypeDto.getFilters(), 1);
FilterDto filterDto = userWidget1.getDiagram().getFilters().get(0);
FilterDto filterDto = userWidget.getDiagram().getFilters().get(0);
UserFilterDto userFilterDto = graphTypeDto.getFilters().get(0);
assertEquals(filterDto.getId(), userFilterDto.getFilter());
assertEquals(filterDto.getValues().get(2).getId(), userFilterDto.getValues().get(0));
WidgetResponse userWidget = userWidget1;
assertAccomodationWidget(userWidget, WidgetValidationStrategy.WIDGET_DATA_1_FILTER);
}
......@@ -74,6 +73,7 @@ public class DashboardWidgetController_SavePreferences_Test extends DashboardWid
//creates my dashboard if it didn't exist
DashboardResponse myDashboard = getMyDashboard(Language.ET, USER_REGULAR);
assertNotNull(myDashboard.getWidgets());
//my dashboard widget has same preferences as old widget
WidgetResponse myDashboardWidget = getWidget(myDashboard.getId(), accommodationId, Language.ET, GraphTypeEnum.line, USER_REGULAR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment