-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b39dc34
commit 3a5a56b
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,28 @@ describe('POST API Route', () => { | |
expect(jsonResponse.error).toBeDefined(); | ||
expect(jsonResponse.error).toBe('Ungültiges Passwort'); | ||
}); | ||
|
||
it('returns error when email is not registered', async () => { | ||
const mockContext = { | ||
request: { | ||
formData: vi.fn().mockResolvedValue({ | ||
get: vi.fn((key) => { | ||
const data = { | ||
email: '[email protected]', | ||
password: '1234' | ||
}; | ||
return data[key]; | ||
}), | ||
}) | ||
} | ||
}; | ||
|
||
const response = await POST(mockContext); | ||
|
||
expect(response.status).toBe(400); | ||
|
||
const jsonResponse = await response.json(); | ||
expect(jsonResponse.error).toBeDefined(); | ||
expect(jsonResponse.error).toBe('E-Mail ist bei uns nicht registriert.'); | ||
}); | ||
}); |