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 4e9e37f commit befc081
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/integration/pages/api/auth/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ import { POST } from '../../../../../src/pages/api/auth/login';

describe('POST API Route', () => {
it('returns error when email is invalid', async () => {
expect(true).toBe(true);
const mockContext = {
request: {
formData: vi.fn().mockResolvedValue({
get: vi.fn(() => 'a@')
})
}
};

const response = await POST(mockContext);

expect(response.status).toBe(400);
const jsonResponse = await response.json();
expect(jsonResponse.error).toBeDefined();
expect(jsonResponse.error).toBe('Ungültige E-Mail');
});
});

0 comments on commit befc081

Please sign in to comment.