/**
 * L2 回归测试：通知系统
 * 注意：通知 API 标记已读是 POST /api/notifications/read，不是 PUT
 */
import { test, expect } from '@playwright/test';
import { apiGet, apiPost, initApiClient, disposeApiClient } from '../helpers/api-client';

test.describe('通知系统 (Notifications)', () => {
  test.beforeAll(async () => { await initApiClient(); });
  test.afterAll(async () => { await disposeApiClient(); });

  test('N01: 获取通知列表 GET /api/notifications', async () => {
    const res = await apiGet('/api/notifications');
    // 可能成功(0)或需要认证(401)
    expect([0, 401]).toContain(res.code);
  });

  test('N02: 标记已读 POST /api/notifications/read', async () => {
    const res = await apiPost('/api/notifications/read', { id: '1' });
    // 可能成功(0)、未找到(404)或需要认证(401)
    expect([0, 401, 404]).toContain(res.code);
  });

  test('N03: 获取未读数量 - 该接口不存在', async () => {
    // /api/notifications/unread-count 路由不存在，跳过
    test.skip();
  });
});