Files
hope-food-pantry-app/tests/shift-options.test.ts
blake 5e0e4a55a8 feat: show the private signup address and let coordinators correct contacts
The confirmation page prints the full manage URL so it can be copied before the browser drops it. A saved contact can be corrected in place, and shift menus group choices by date.
2026-10-19 12:12:23 -05:00

25 lines
1009 B
TypeScript

import { describe, expect, it } from 'vitest';
import { groupShiftTargets } from '../src/shift-options.js';
import type { MoveTarget } from '../src/admin/store.js';
function target(id: number, date: string, dateLabel: string): MoveTarget {
return { id, date, dateLabel, label: `Shift ${id}` };
}
describe('shift menu groups', () => {
it('keeps same-day shifts together and leaves a later repeat of that date in place', () => {
const groups = groupShiftTargets([
target(1, '2026-10-20', 'Tuesday, October 20, 2026'),
target(2, '2026-10-20', 'Tuesday, October 20, 2026'),
target(3, '2026-10-21', 'Wednesday, October 21, 2026'),
target(4, '2026-10-20', 'Tuesday, October 20, 2026'),
]);
expect(groups.map((group) => group.targets.map((item) => item.id))).toEqual([[1, 2], [3], [4]]);
expect(groups.map((group) => group.dateLabel)).toEqual([
'Tuesday, October 20, 2026',
'Wednesday, October 21, 2026',
'Tuesday, October 20, 2026',
]);
});
});