feat: allow deleting standalone assets and debts

This commit is contained in:
陈煜 committed 2026-10-04 12:26:14 +08:00
1 parent 3edf611833
commit c0ad193c73
8 files changed
+212 -40

No files matched your search

+12 -7
View File
@@ -65,18 +65,12 @@ test('account deletion checks ownership and hidden visibility before deleting or
await f.service.remove({ ...owner, revealed: true }, 'account', { confirmation: '测试账户' });
assert.deepEqual(f.state(), { deleted: true, invalidated: true });
});
test('wrong confirmation, non-accounts, paired movements and schedules cannot cascade', async () => {
test('wrong confirmation, paired movements and schedules cannot cascade', async () => {
const f = fixture();
await assert.rejects(
() => f.service.remove(owner, 'account', { confirmation: '错误名称' }),
BadRequestException,
);
f.row.kind = 'asset';
await assert.rejects(
() => f.service.remove(owner, 'account', { confirmation: '测试账户' }),
BadRequestException,
);
f.row.kind = 'account';
f.setMovements(1);
await assert.rejects(
() => f.service.remove(owner, 'account', { confirmation: '测试账户' }),
@@ -95,3 +89,14 @@ test('wrong confirmation, non-accounts, paired movements and schedules cannot ca
});
assert.deepEqual(f.state(), { deleted: true, invalidated: true });
});
test('standalone assets and debts support deletion and invalidate totals', async () => {
for (const kind of ['asset', 'debt']) {
const f = fixture();
f.row.kind = kind;
assert.deepEqual(await f.service.remove(owner, 'account', { confirmation: '测试账户' }), {
ok: true,
});
assert.deepEqual(f.state(), { deleted: true, invalidated: true });
}
});