fix/add tests, update heatmap range, finish android release, add readme
Stop tracking gradle.properties
This commit is contained in:
@@ -73,6 +73,21 @@ describe('Controllers', () => {
|
||||
await ReviewController.submitReview(mockReq({}), reply);
|
||||
expect(reply.code).toHaveBeenCalledWith(404);
|
||||
});
|
||||
|
||||
it('submitLesson should succeed', async () => {
|
||||
const reply = mockReply();
|
||||
ReviewService.processLesson.mockResolvedValue({ success: true });
|
||||
await ReviewController.submitLesson(mockReq({ subjectId: 100 }), reply);
|
||||
expect(reply.send).toHaveBeenCalledWith({ success: true });
|
||||
});
|
||||
|
||||
it('submitLesson should handle error', async () => {
|
||||
const reply = mockReply();
|
||||
ReviewService.processLesson.mockRejectedValue(new Error('Lesson error'));
|
||||
await ReviewController.submitLesson(mockReq({ subjectId: 100 }), reply);
|
||||
expect(reply.code).toHaveBeenCalledWith(404);
|
||||
expect(reply.send).toHaveBeenCalledWith({ error: 'Lesson error' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sync Controller', () => {
|
||||
@@ -113,6 +128,20 @@ describe('Controllers', () => {
|
||||
expect(ReviewService.getQueue).toHaveBeenCalledWith(expect.anything(), 50, undefined);
|
||||
});
|
||||
|
||||
it('getLessonQueue should call service with explicit limit', async () => {
|
||||
const reply = mockReply();
|
||||
ReviewService.getLessonQueue.mockResolvedValue([]);
|
||||
await CollectionController.getLessonQueue(mockReq({}, {}, { limit: '10' }), reply);
|
||||
expect(ReviewService.getLessonQueue).toHaveBeenCalledWith(expect.anything(), 10);
|
||||
});
|
||||
|
||||
it('getLessonQueue should use default limit when none provided', async () => {
|
||||
const reply = mockReply();
|
||||
ReviewService.getLessonQueue.mockResolvedValue([]);
|
||||
await CollectionController.getLessonQueue(mockReq({}, {}, {}), reply);
|
||||
expect(ReviewService.getLessonQueue).toHaveBeenCalledWith(expect.anything(), 10);
|
||||
});
|
||||
|
||||
it('getStats should call service', async () => {
|
||||
const reply = mockReply();
|
||||
StatsService.getUserStats.mockResolvedValue({});
|
||||
|
||||
Reference in New Issue
Block a user