Skip to content

Commit ed25cb3

Browse files
author
kali
committed
fix(api): return bad request for malformed notify JSON
1 parent 3ed113d commit ed25cb3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

app/api/notify/route.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
22
import { NextRequest } from 'next/server';
33
import { GET, POST } from './route';
4+
import dbConnect from '@/lib/mongodb';
45

56
// Mock dependencies
67
vi.mock('@/lib/mongodb', () => ({ default: vi.fn() }));
@@ -88,6 +89,7 @@ describe('POST /api/notify', () => {
8889
expect(res.status).toBe(400);
8990
const data = await res.json();
9091
expect(data.message).toContain('Malformed JSON');
92+
expect(dbConnect).not.toHaveBeenCalled();
9193
});
9294

9395
// ── Rate limiting ────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)