Public Access
feat(user): add chart forms for TOP_GAMES, ACTIVITY, ACTIVITY_GAMES
This commit is contained in:
1 parent
365b69feb4
commit
395b8e6f99
3 files changed
+21
-6
No files matched your search
@@ -16,7 +16,10 @@ public final class StatCharts {
|
||||
"TREND", Set.of("LINE", "BARS"),
|
||||
"FINISHED", Set.of("BARS", "LINE", "LIST"),
|
||||
"TASTE", Set.of("BARS", "PIE", "DONUT", "LIST"),
|
||||
"PLATFORMS", Set.of("BARS", "PIE", "DONUT", "LIST"));
|
||||
"PLATFORMS", Set.of("BARS", "PIE", "DONUT", "LIST"),
|
||||
"TOP_GAMES", Set.of("LIST", "BARS", "PIE", "DONUT"),
|
||||
"ACTIVITY", Set.of("BARS", "LINE"),
|
||||
"ACTIVITY_GAMES", Set.of("LIST", "BARS", "PIE", "DONUT"));
|
||||
|
||||
private StatCharts() {
|
||||
}
|
||||
|
||||
@@ -475,16 +475,23 @@ class UserControllerTest extends AbstractWebMvcTest {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"group\":\"FINISHED\",\"chart\":null}"))
|
||||
.andExpect(status().isNoContent());
|
||||
mockMvc.perform(put("/api/users/settings/stat-chart")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"group\":\"ACTIVITY_GAMES\",\"chart\":\"DONUT\"}"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
verify(userService).updateStatChart(1L, "PLATFORMS", "PIE");
|
||||
verify(userService).updateStatChart(1L, "FINISHED", null);
|
||||
verify(userService).updateStatChart(1L, "ACTIVITY_GAMES", "DONUT");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {
|
||||
"{\"group\":\"TASTE\",\"chart\":\"LINE\"}",
|
||||
"{\"group\":\"TOP_GAMES\",\"chart\":\"LIST\"}",
|
||||
"{\"group\":\"TOP_GAMES\",\"chart\":null}",
|
||||
"{\"group\":\"HABITS\",\"chart\":\"LIST\"}",
|
||||
"{\"group\":\"HABITS\",\"chart\":null}",
|
||||
"{\"group\":\"TOP_GAMES\",\"chart\":\"LINE\"}",
|
||||
"{\"group\":\"ACTIVITY\",\"chart\":\"PIE\"}",
|
||||
"{\"group\":\"UNKNOWN\",\"chart\":\"BARS\"}",
|
||||
"{\"group\":\"platforms\",\"chart\":\"PIE\"}",
|
||||
"{\"group\":\"PLATFORMS\",\"chart\":\"RADAR\"}",
|
||||
|
||||
@@ -17,13 +17,16 @@ class StatChartsTest extends AbstractUnitTest {
|
||||
@ParameterizedTest
|
||||
@CsvSource({"TREND,LINE", "TREND,BARS", "FINISHED,BARS", "FINISHED,LINE", "FINISHED,LIST", "TASTE,BARS",
|
||||
"TASTE,PIE", "TASTE,DONUT", "TASTE,LIST", "PLATFORMS,BARS", "PLATFORMS,PIE", "PLATFORMS,DONUT",
|
||||
"PLATFORMS,LIST"})
|
||||
"PLATFORMS,LIST", "TOP_GAMES,LIST", "TOP_GAMES,BARS", "TOP_GAMES,PIE", "TOP_GAMES,DONUT",
|
||||
"ACTIVITY,BARS", "ACTIVITY,LINE", "ACTIVITY_GAMES,LIST", "ACTIVITY_GAMES,BARS", "ACTIVITY_GAMES,PIE",
|
||||
"ACTIVITY_GAMES,DONUT"})
|
||||
void allows_EachAllowedPair(String group, String chart) {
|
||||
assertTrue(StatCharts.allows(group, chart));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"TASTE,LINE", "TOP_GAMES,LIST", "UNKNOWN,BARS", "platforms,PIE", "PLATFORMS,pie", "PLATFORMS,RADAR",
|
||||
@CsvSource({"TASTE,LINE", "HABITS,LIST", "TOP_GAMES,LINE", "ACTIVITY,PIE", "ACTIVITY_GAMES,LINE",
|
||||
"UNKNOWN,BARS", "platforms,PIE", "PLATFORMS,pie", "PLATFORMS,RADAR",
|
||||
"TREND,PIE"})
|
||||
void allows_OtherPairs_AreRefused(String group, String chart) {
|
||||
assertFalse(StatCharts.allows(group, chart));
|
||||
@@ -32,7 +35,9 @@ class StatChartsTest extends AbstractUnitTest {
|
||||
@Test
|
||||
void knows_OnlyTheChartableGroups() {
|
||||
assertTrue(StatCharts.knows("PLATFORMS"));
|
||||
assertFalse(StatCharts.knows("TOP_GAMES"));
|
||||
assertTrue(StatCharts.knows("TOP_GAMES"));
|
||||
assertTrue(StatCharts.knows("ACTIVITY_GAMES"));
|
||||
assertFalse(StatCharts.knows("HABITS"));
|
||||
assertFalse(StatCharts.knows("platforms"));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user