Milestone 3: launch (20261008.05)
Backup and restore: restore from Settings (any backup in the folder, or an
uploaded file) or from the command line with scripts/restore.sh. Each restore
checks the file first, saves a copy of the current data so it can be undone,
and keeps the person restoring signed in. Backups are now single
self-contained files. Drilled end to end: last night's backup brings
everything back exactly, including onto an empty new machine.
Speed: a phone's first load is 147 KB compressed (target 150). The ideas box,
account menu and sign-in screens load on demand, a small built-in toast
replaces sonner, the Inter font is trimmed to the characters used, and files
and API answers are served compressed. Every screen's data comes back in
under 100 ms with 50,000 transactions (server/bench).
Accessibility: no WCAG 2.2 AA issues on any screen in either theme. Darker
status text colors, 44 px touch targets on phones, reduced motion honoured,
and focus returns after dialogs close.
Also: an in-app guide ("How Spendlight works"), OFX/QFX/QBO import, and tags
on individual parts of a split purchase.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -333,6 +333,38 @@ describe('managing categories, rules and tags', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('tags on split parts', () => {
|
||||
it('finds, totals and exports a tag on one part of a purchase', async () => {
|
||||
const page = (await admin.get('/api/v1/transactions?q=Kroger&limit=1')).json;
|
||||
const kroger = page.items[0];
|
||||
const groceries = await category('Groceries');
|
||||
const household = await category('Household Supplies');
|
||||
const split = await admin.call('PUT', `/api/v1/transactions/${kroger.id}/split`, {
|
||||
parts: [
|
||||
{ categoryId: groceries, amountCents: kroger.amountCents + 1500 },
|
||||
{ categoryId: household, amountCents: -1500, tags: ['Reimbursable'] },
|
||||
],
|
||||
});
|
||||
expect(split.json.splits.map((x: { tags: string[] }) => x.tags)).toEqual([[], ['Reimbursable']]);
|
||||
|
||||
const found = (await admin.get('/api/v1/transactions?tag=reimbursable')).json;
|
||||
expect(found.items.map((x: { id: number }) => x.id)).toEqual([kroger.id]);
|
||||
const report = (await admin.get('/api/v1/reports/tags')).json as { tag: string; spent: number; count: number; byCategory: { categoryId: number }[] }[];
|
||||
expect(report.find((r) => r.tag === 'Reimbursable')).toMatchObject({ spent: 1500, count: 1, byCategory: [{ categoryId: household, cents: 1500 }] });
|
||||
expect((await admin.get('/api/v1/tags')).json).toEqual([{ id: expect.any(Number), name: 'Reimbursable', count: 1 }]);
|
||||
|
||||
// Tagging the whole purchase too doesn't count the tagged part twice.
|
||||
await admin.patch(`/api/v1/transactions/${kroger.id}`, { tags: ['Reimbursable'] });
|
||||
const both = (await admin.get('/api/v1/reports/tags')).json as { tag: string; spent: number }[];
|
||||
expect(both.find((r) => r.tag === 'Reimbursable')!.spent).toBe(-kroger.amountCents);
|
||||
|
||||
const res = await t.app.request(`http://localhost/api/v1/export/transactions.csv?tag=Reimbursable`, { headers: { Cookie: `sl_session=${admin.cookie('sl_session')}` } });
|
||||
const lines = Buffer.from(await res.arrayBuffer()).subarray(3).toString('utf8').trim().split('\r\n');
|
||||
expect(lines).toHaveLength(3);
|
||||
expect(lines.every((l, i) => i === 0 || l.includes('Reimbursable'))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('export', () => {
|
||||
it('writes CSV that defuses formulas and splits rows by part', async () => {
|
||||
expect(buildCsv(['A', 'B'], [['=HYPERLINK("x")', { money: -1234 }], ['a,b', 5]])).toBe('\uFEFFA,B\r\n"\'=HYPERLINK(""x"")",-12.34\r\n"a,b",5\r\n');
|
||||
|
||||
Reference in New Issue
Block a user