aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/pages/StudyPage.test.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/pages/StudyPage.test.tsx')
-rw-r--r--src/client/pages/StudyPage.test.tsx26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/pages/StudyPage.test.tsx b/src/client/pages/StudyPage.test.tsx
index dfadea9..68a7bb3 100644
--- a/src/client/pages/StudyPage.test.tsx
+++ b/src/client/pages/StudyPage.test.tsx
@@ -518,6 +518,32 @@ describe("StudyPage", () => {
);
});
+ it("rates card as Good with Space key when card is flipped", async () => {
+ const user = userEvent.setup();
+
+ mockStudyPost.mockResolvedValue({
+ card: { ...mockFirstCard, reps: 1 },
+ });
+
+ renderWithProviders({
+ initialStudyData: { deck: mockDeck, cards: mockDueCards },
+ });
+
+ await user.keyboard(" "); // Flip
+ await user.keyboard(" "); // Rate as Good (Space)
+
+ await waitFor(() => {
+ expect(screen.getByTestId("card-front").textContent).toBe("Goodbye");
+ });
+
+ expect(mockStudyPost).toHaveBeenCalledWith(
+ expect.objectContaining({
+ param: { deckId: "deck-1", cardId: "card-1" },
+ json: expect.objectContaining({ rating: 3 }),
+ }),
+ );
+ });
+
it("supports all rating keys (1, 2, 3, 4)", async () => {
const user = userEvent.setup();