08-notifications.spec.ts 904 B

12345678910111213141516171819202122232425
  1. /**
  2. * L2 回归测试:通知系统
  3. */
  4. import { test, expect } from '@playwright/test';
  5. import { apiGet, apiPut, initApiClient, disposeApiClient } from '../helpers/api-client';
  6. test.describe('通知系统 (Notifications)', () => {
  7. test.beforeAll(async () => { await initApiClient(); });
  8. test.afterAll(async () => { await disposeApiClient(); });
  9. test('N01: 获取通知列表 GET /api/notifications', async () => {
  10. const res = await apiGet('/api/notifications');
  11. expect(res.code).toBe(0);
  12. });
  13. test('N02: 标记已读 PUT /api/notifications/read', async () => {
  14. const res = await apiPut('/api/notifications/read', { id: '1' });
  15. expect([0, 404]).toContain(res.code);
  16. });
  17. test('N03: 获取未读数量 GET /api/notifications/unread-count', async () => {
  18. const res = await apiGet('/api/notifications/unread-count');
  19. expect([0, 404]).toContain(res.code);
  20. });
  21. });