feat: testen voor submissions geimplementeerd

This commit is contained in:
Adriaan Jacquet 2025-03-29 21:56:56 +01:00
parent f0eb4822d9
commit 7a443c0686
3 changed files with 27 additions and 14 deletions

View file

@ -1,12 +1,16 @@
export function checkReturnList(jsonMock: Mock, listName: string) {
export function checkReturnList(jsonMock: Mock, listName: string, length?: number) {
expect(jsonMock).toHaveBeenCalled();
const result = jsonMock.mock.lastCall![0];
expect(listName in result).toBeTruthy();
if (length) {
expect(result[listName].length).toBe(length);
}
}
export function checkReturn404(jsonMock: Mock, statusMock: Mock) {
expect(statusMock).toHaveBeenCalledWith(404);
expect(jsonMock).toHaveBeenCalled();
expect(statusMock).toHaveBeenCalledWith(404);
expect(jsonMock).toHaveBeenCalled();
}