describe('Notification Flow', () => { const ADMIN_TOKEN = 'c86ae7afbe10fabe3c1d5e1a7fee74feaadfd5dc7be2ab62' const authHeaders = { Authorization: `Bearer ${ADMIN_TOKEN}` } it('fetches notifications', () => { cy.request({ url: '/api/notifications', headers: authHeaders }).then(res => { expect(res.status).to.eq(200) expect(res.body).to.be.an('array') }) }) it('each notification has required fields', () => { cy.request({ url: '/api/notifications', headers: authHeaders }).then(res => { if (res.body.length > 0) { const n = res.body[0] expect(n).to.have.property('title') expect(n).to.have.property('is_read') expect(n).to.have.property('created_at') } }) }) it('can mark all notifications as read', () => { cy.request({ method: 'POST', url: '/api/notifications/read-all', headers: authHeaders, body: {} }).then(res => { expect(res.status).to.eq(200) }) }) it('all notifications are now read', () => { cy.request({ url: '/api/notifications', headers: authHeaders }).then(res => { const unread = res.body.filter(n => !n.is_read) expect(unread).to.have.length(0) }) }) })