diff --git a/app.tsx b/app.tsx
index 7cef6939..a457b45b 100644
--- a/app.tsx
+++ b/app.tsx
@@ -341,7 +341,7 @@
function formatDistributionFrequency(value: unknown): string {
const raw = String(value ?? '').trim();
const normalized = raw.toLowerCase().replace(/[‐‑‒–—]/g, '-').replace(/\s+/g, ' ');
- if (!normalized || normalized === '-' || normalized === '—') return '00 - —';
+ if (!normalized || normalized === '-' || normalized === '—') return '00 - None';
if (normalized === 'monthly') return '01 - Monthly';
if (normalized === 'quarterly') return '04 - Quarterly';
if (normalized === 'semiannually' || normalized === 'semi-annually' || normalized === 'semi-annual' || normalized === 'semiannual') return '06 - Semi-annually';
@@ -1172,7 +1172,7 @@
${escapeHtml(fund.ter || '—')} |
${formatPercent(fund.dividendYield)} |
— |
- ${escapeHtml(fund.frequencyCode || '00 - —')} |
+ ${escapeHtml(fund.frequencyCode || '00 - None')} |
${formatPercent(fund.ytd)} |
${formatPercent(fund.yr1)} |
${formatPercent(fund.tr3y)} |
diff --git a/scripts/update-data.test.ts b/scripts/update-data.test.ts
index c33a7384..d5ae24c9 100644
--- a/scripts/update-data.test.ts
+++ b/scripts/update-data.test.ts
@@ -930,13 +930,13 @@ describe('formatDistributionFrequency (catalog Frequency column)', () => {
expect(formatDistributionFrequency('monthly')).toBe('01 - Monthly');
});
- test('treats missing data as "00 - —" instead of dropping the cell', () => {
- expect(formatDistributionFrequency(undefined)).toBe('00 - —');
- expect(formatDistributionFrequency(null)).toBe('00 - —');
- expect(formatDistributionFrequency('')).toBe('00 - —');
- expect(formatDistributionFrequency(' ')).toBe('00 - —');
- expect(formatDistributionFrequency('-')).toBe('00 - —');
- expect(formatDistributionFrequency('—')).toBe('00 - —');
+ test('treats missing data as "00 - None" instead of dropping the cell', () => {
+ expect(formatDistributionFrequency(undefined)).toBe('00 - None');
+ expect(formatDistributionFrequency(null)).toBe('00 - None');
+ expect(formatDistributionFrequency('')).toBe('00 - None');
+ expect(formatDistributionFrequency(' ')).toBe('00 - None');
+ expect(formatDistributionFrequency('-')).toBe('00 - None');
+ expect(formatDistributionFrequency('—')).toBe('00 - None');
});
test('passes an unknown published value through unchanged', () => {
@@ -950,3 +950,24 @@ describe('formatDistributionFrequency (catalog Frequency column)', () => {
expect(codes).toEqual(['00 - None', '01 - Monthly', '04 - Quarterly', '06 - Semi-annually', '12 - Annually', '99 - Irregular']);
});
});
+
+
+import { test as frequencyLabelTest, expect as frequencyLabelExpect } from 'bun:test';
+frequencyLabelTest('Frequency placeholders display None and existing cadence labels stay unchanged', async () => {
+ const text = await Bun.file(new URL('../app.tsx', import.meta.url)).text();
+ const start = /^([ \t]*)function (formatDividendFrequency|formatDistributionFrequency)\(/m.exec(text);
+ frequencyLabelExpect(start).not.toBeNull();
+ const tail = text.slice(start!.index);
+ const end = new RegExp('^' + start![1] + '\u007d', 'm').exec(tail);
+ frequencyLabelExpect(end).not.toBeNull();
+ const js = new Bun.Transpiler({ loader: 'ts' }).transformSync(tail.slice(0, end!.index + end![0].length));
+ const format = new Function(js + '; return ' + start![2] + ';')();
+ for (const value of [null, undefined, '', ' ', '-', '‐', '‑', '‒', '–', '—', ' — ']) {
+ frequencyLabelExpect(format(value)).toBe('00 - None');
+ }
+ for (const [input, expected] of [
+ ['None', '00 - None'], ['Unknown', '00 - Unknown'], ['Monthly', '01 - Monthly'],
+ ['Quarterly', '04 - Quarterly'], ['Semi-annually', '06 - Semi-annually'],
+ ['Annually', '12 - Annually'], ['Irregular', '99 - Irregular'],
+ ]) frequencyLabelExpect(format(input)).toBe(expected);
+});