Expand test suite to 364 tests (168 unit + 196 E2E)
Unit tests: - Volume/dilution calculation (63 tests): scaling, mode detection, ratio calculation, real recipe round-trip verification E2E tests: - Batch operations: create/tag/delete 3 recipes, adopt workflow - Projects: CRUD, pricing, profit calculation vs oil costs - Notifications: fetch, fields, mark-all-read - Account settings: profile read/update, auth rejection - Category modules: listing, tag reference - Registration: register, login, duplicate rejection - Audit log: pagination, field validation, action tracking Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
38
frontend/cypress/e2e/notification-flow.cy.js
Normal file
38
frontend/cypress/e2e/notification-flow.cy.js
Normal file
@@ -0,0 +1,38 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user