Add Expenses app

A UI based on [Budget Zen](https://github.com/BrunoBernardino/budgetzen-web) but slightly updated and adjusted for bewCloud. It also features a chart with available money and spent by budgets.

This is useful for envelope-based budgeting.
This commit is contained in:
Bruno Bernardino
2025-02-26 17:43:53 +00:00
parent 869e712432
commit 874ab006f9
29 changed files with 2677 additions and 12 deletions

View File

@@ -1,8 +1,11 @@
import { assertEquals } from 'std/assert/assert_equals.ts';
import { SupportedCurrencySymbol } from '/lib/types.ts';
import {
convertFormDataToObject,
convertObjectToFormData,
escapeHtml,
formatNumber,
generateHash,
generateRandomCode,
isRunningLocally,
@@ -269,3 +272,22 @@ Deno.test('that isRunningLocally works', () => {
assertEquals(result, test.expected);
}
});
Deno.test('that formatNumber works', () => {
const tests: { currency: SupportedCurrencySymbol; number: number; expected: string }[] = [
{ currency: '$', number: 10000, expected: '$10,000' },
{ currency: '$', number: 10000.5, expected: '$10,000.5' },
{ currency: '€', number: 10000, expected: '€10,000' },
{ currency: '€', number: 900.999, expected: '€901' },
{ currency: '€', number: 900.991, expected: '€900.99' },
{ currency: '$', number: 50.11, expected: '$50.11' },
{ currency: '£', number: 900.999, expected: '£901' },
{ currency: '£', number: 900.991, expected: '£900.99' },
{ currency: '£', number: 50.11, expected: '£50.11' },
];
for (const test of tests) {
const result = formatNumber(test.currency, test.number);
assertEquals(result, test.expected);
}
});