Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
wesolowski committed Jun 8, 2024
1 parent b39dc34 commit 3a5a56b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/pages/api/auth/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
});
});

0 comments on commit 3a5a56b

Please sign in to comment.