feat: online ordering settings (services, hours, preparation, slots) and the order app e2e (platform-v2 3S, S.4)
- connect_orders.ordering setting; GET/PUT /api/connect/fees/ordering (validated: services, hours per day incl. past midnight, preparation, slot minutes, days ahead, ASAP); pushed to the cloud with the menu (snapshot `ordering`). - Manager: the Online ordering page gains "Services and hours" (OrderingSettings.jsx; logic in feesLogic.js, unit-tested); nav label "Online ordering". - tests/e2e/order_app.mjs: a real cloud + the built order app in a phone-sized browser: takeaway and delivery placed, priced by the cloud (fee by area, minimum refused), the site moves the delivery to delivered and the page follows; a rejection with its reason; Greek. In run-all, with the order app's unit tests. - Tests: backend +1 (406), manager unit +1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,3 +49,17 @@ test('moving rules and the test form', () => {
|
||||
assert.deepEqual(previewBody({ sales_point: 'online_delivery', where: 'area', area_id: '2', postcode: '', subtotal: '', items: '', day: '5', time: '23:30' }),
|
||||
{ sales_point: 'online_delivery', area_id: 2, postcode: null, subtotal: 0, items: 0, weekday: 5, time: '23:30' })
|
||||
})
|
||||
|
||||
test('online ordering settings: hours per day, any time, numbers', async () => {
|
||||
const { orderingBody, orderingToForm } = await import('../src/pages/online/feesLogic.js')
|
||||
const saved = { services: ['delivery'], hours: { 5: [['20:00', '02:00']] }, prep_minutes: 30, slot_minutes: 15, days_ahead: 1, asap: false }
|
||||
const form = orderingToForm(saved)
|
||||
assert.equal(form.anyTime, false)
|
||||
assert.deepEqual(form.days[5], [{ from: '20:00', to: '02:00' }])
|
||||
assert.deepEqual(orderingBody(form), saved)
|
||||
assert.deepEqual(orderingBody({ ...form, anyTime: true }).hours, {})
|
||||
const blank = orderingToForm(null)
|
||||
assert.deepEqual(orderingBody({ ...blank, prep_minutes: '' }), { services: [], hours: {}, prep_minutes: 20, slot_minutes: 15, days_ahead: 0, asap: true })
|
||||
form.days[0] = [{ from: '12:00', to: '12:00' }, { from: '', to: '15:00' }]
|
||||
assert.equal(orderingBody(form).hours['0'], undefined)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user