@happyvertical/smrt-projects 0.40.70 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +383 -256
- package/dist/migrations/moneyMinorUnits.d.ts +26 -0
- package/dist/migrations/moneyMinorUnits.d.ts.map +1 -0
- package/dist/models/service-evidence.d.ts +16 -0
- package/dist/models/service-evidence.d.ts.map +1 -1
- package/dist/playground.js +6 -6
- package/dist/playground.js.map +1 -1
- package/dist/services/service-evidence-service.d.ts +8 -0
- package/dist/services/service-evidence-service.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +60 -9
- package/dist/svelte/ServiceEvidenceList.svelte +17 -4
- package/dist/svelte/ServiceEvidenceList.svelte.d.ts.map +1 -1
- package/dist/svelte/components/__tests__/TimeEntryCard.test.js +2 -2
- package/dist/svelte/components/utils.d.ts +10 -1
- package/dist/svelte/components/utils.d.ts.map +1 -1
- package/dist/svelte/components/utils.js +19 -4
- package/dist/svelte/delivery-types.d.ts +2 -0
- package/dist/svelte/delivery-types.d.ts.map +1 -1
- package/dist/svelte/playground.d.ts.map +1 -1
- package/dist/svelte/playground.js +7 -6
- package/dist/svelte/utils.d.ts +10 -1
- package/dist/svelte/utils.d.ts.map +1 -1
- package/dist/svelte/utils.js +19 -4
- package/dist/svelte/utils.test.js +44 -0
- package/package.json +12 -11
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency formatting for integer minor units (#2401).
|
|
3
|
+
*
|
|
4
|
+
* `formatCurrency` receives what the database stores — integer minor units —
|
|
5
|
+
* and `Intl.NumberFormat` formats major units, so the scale has to be undone
|
|
6
|
+
* first. Which scale depends on the currency, which is the trap this file
|
|
7
|
+
* guards: a hard-coded `/100`, or a `minimumFractionDigits: 2` override that
|
|
8
|
+
* pins the resolved exponent to 2, both mis-render every currency that does not
|
|
9
|
+
* have exactly two decimal places.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, expect, it } from 'vitest';
|
|
12
|
+
import { formatCurrency as formatCurrencyFromComponents } from './components/utils.js';
|
|
13
|
+
import { formatCurrency } from './utils.js';
|
|
14
|
+
describe('formatCurrency (#2401)', () => {
|
|
15
|
+
it('renders a two-decimal currency by undoing the cent scale', () => {
|
|
16
|
+
// 19999 minor units is $199.99, not $19,999.00.
|
|
17
|
+
expect(formatCurrency(19999, 'CAD')).toContain('199.99');
|
|
18
|
+
expect(formatCurrency(19999, 'CAD')).not.toContain('19,999');
|
|
19
|
+
});
|
|
20
|
+
it('renders zero as the currency zero rather than nothing', () => {
|
|
21
|
+
expect(formatCurrency(0, 'CAD')).toContain('0.00');
|
|
22
|
+
});
|
|
23
|
+
it('does not rescale or add decimals to a zero-decimal currency', () => {
|
|
24
|
+
// JPY has no minor unit, so 1999 is ¥1,999 — dividing by 100 here would
|
|
25
|
+
// report ¥19.99, a hundredfold understatement, and printing two decimals
|
|
26
|
+
// would invent a fractional part the currency does not have.
|
|
27
|
+
const formatted = formatCurrency(1999, 'JPY');
|
|
28
|
+
expect(formatted).toContain('1,999');
|
|
29
|
+
expect(formatted).not.toContain('1,999.00');
|
|
30
|
+
});
|
|
31
|
+
it('uses a three-decimal currency exponent for a three-decimal currency', () => {
|
|
32
|
+
// BHD is 1000 fils to the dinar, so 1999 fils is BHD 1.999.
|
|
33
|
+
expect(formatCurrency(1999, 'BHD')).toContain('1.999');
|
|
34
|
+
});
|
|
35
|
+
it('is duplicated verbatim under components/, so both copies must agree', () => {
|
|
36
|
+
for (const [amount, currency] of [
|
|
37
|
+
[19999, 'CAD'],
|
|
38
|
+
[1999, 'JPY'],
|
|
39
|
+
[0, 'USD'],
|
|
40
|
+
]) {
|
|
41
|
+
expect(formatCurrencyFromComponents(amount, currency)).toBe(formatCurrency(amount, currency));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-projects",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Provider-agnostic project management models (Issues, PRs, Repositories, Projects) for SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"smrtRawPrimitives": "strict",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@happyvertical/repos": "^0.88.0",
|
|
41
41
|
"@happyvertical/sql": "^0.88.0",
|
|
42
42
|
"@happyvertical/utils": "^0.88.0",
|
|
43
|
-
"@happyvertical/smrt-config": "0.
|
|
44
|
-
"@happyvertical/smrt-
|
|
45
|
-
"@happyvertical/smrt-
|
|
46
|
-
"@happyvertical/smrt-
|
|
47
|
-
"@happyvertical/smrt-subscriptions": "0.
|
|
48
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
49
|
-
"@happyvertical/smrt-types": "0.
|
|
50
|
-
"@happyvertical/smrt-ui": "0.
|
|
43
|
+
"@happyvertical/smrt-config": "0.41.0",
|
|
44
|
+
"@happyvertical/smrt-core": "0.41.0",
|
|
45
|
+
"@happyvertical/smrt-svelte": "0.41.0",
|
|
46
|
+
"@happyvertical/smrt-prompts": "0.41.0",
|
|
47
|
+
"@happyvertical/smrt-subscriptions": "0.41.0",
|
|
48
|
+
"@happyvertical/smrt-tenancy": "0.41.0",
|
|
49
|
+
"@happyvertical/smrt-types": "0.41.0",
|
|
50
|
+
"@happyvertical/smrt-ui": "0.41.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"svelte": "^5.56.4"
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "5.9.3",
|
|
68
68
|
"vite": "8.1.4",
|
|
69
69
|
"vitest": "4.1.10",
|
|
70
|
-
"@happyvertical/smrt-cli": "0.
|
|
71
|
-
"@happyvertical/smrt-vitest": "0.
|
|
70
|
+
"@happyvertical/smrt-cli": "0.41.0",
|
|
71
|
+
"@happyvertical/smrt-vitest": "0.41.0"
|
|
72
72
|
},
|
|
73
73
|
"keywords": [
|
|
74
74
|
"ai",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"clean": "rm -rf dist",
|
|
99
99
|
"dev": "vite dev",
|
|
100
100
|
"test": "vitest run",
|
|
101
|
+
"test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run optional.test.ts",
|
|
101
102
|
"test:watch": "vitest",
|
|
102
103
|
"verify:pack": "node ../../scripts/verify-package-types-exports.js ."
|
|
103
104
|
}
|