-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statistics #65
Statistics #65
Changes from 9 commits
3443dd5
01f5393
d572b44
c78a4ea
47f80c0
565f0da
c015c5b
0d37f2b
7e2ca81
f37dd34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,6 @@ | |
<td>{{daysLeft}}</td> | ||
</tr> | ||
</table> | ||
|
||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,5 +39,6 @@ function showUserGoals() { | |
}; | ||
} | ||
w3DisplayData("goals-list", tabledata); | ||
generateMetrics(goals); | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -452,4 +452,41 @@ private GoalFormDto setupGoalFormDto() { | |
result.setDeadline(LocalDate.of(2918, 1, 1)); | ||
return result; | ||
} | ||
|
||
@Test | ||
@DisplayName("test setStatusAchieved: changes status") | ||
void testSetStatusAchieved() { | ||
Long id = goal.getId(); | ||
goal.setStatus(GoalStatus.OVERDUE); | ||
when(userStore.getCurrentUser()) | ||
.thenReturn(user1); | ||
when(goalStore.getGoalById(id)) | ||
.thenReturn(Optional.of(goal)); | ||
goalApi.setStatusAchieved(id); | ||
assertThat(goal.getStatus(), is(GoalStatus.ACHIEVED)); | ||
} | ||
|
||
@Test | ||
@DisplayName("test setStatusAchieved: throws ValidationException wrong user") | ||
void testSetStatusAchievedThrowsExceptionIfWrongUser() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For such long names, underscores can be used to separate parts of names: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok. will remember should i do it now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, better do it, should be quick to do. |
||
Long id = goal.getId(); | ||
goal.setStatus(GoalStatus.OVERDUE); | ||
when(userStore.getCurrentUser()) | ||
.thenReturn(user2); | ||
when(goalStore.getGoalById(id)) | ||
.thenReturn(Optional.of(goal)); | ||
assertThrows(ValidationException.class, () -> goalApi.setStatusAchieved(id)); | ||
} | ||
|
||
@Test | ||
@DisplayName("test setStatusAchieved: throws ValidationException no goal") | ||
void testSetStatusAchievedThrowsExceptionIfNoGoal() { | ||
Long id = goal.getId(); | ||
goal.setStatus(GoalStatus.OPEN); | ||
when(userStore.getCurrentUser()) | ||
.thenReturn(user2); | ||
when(goalStore.getGoalById(id)) | ||
.thenReturn(Optional.empty()); | ||
assertThrows(ValidationException.class, () -> goalApi.setStatusAchieved(id)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have a clearer name, such as
statisticsTable
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will do