test(export): stale-group + same-date ordinal coverage; comment/guard polish
This commit is contained in:
@@ -110,4 +110,15 @@ describe('ExportDataModal', () => {
|
||||
expect(text).toMatch(/^Group,Control,Drug$/m);
|
||||
await dl.restore();
|
||||
});
|
||||
|
||||
it('a stale/unset group field coerces to None (no Group row in the export)', async () => {
|
||||
const dl = mockDownload();
|
||||
renderModal({ groupField: 'ghost-field' });
|
||||
await screen.findByLabelText('X axis (rows)');
|
||||
await waitFor(() => expect(screen.getByText(/2 rows/i)).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByText('Export CSV'));
|
||||
const text = await readBlobText(dl.getBlob());
|
||||
expect(text).not.toMatch(/^Group,/m);
|
||||
await dl.restore();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -237,6 +237,16 @@ describe('buildSampleIndex', () => {
|
||||
expect(idx.get('a1').get(250).date).toContain('2026-07-01');
|
||||
expect(idx.get('a1').get(260).date).toContain('2026-07-03');
|
||||
});
|
||||
it('# days reach counts per-status, not per-distinct-date (same-day statuses get separate ordinals)', () => {
|
||||
const sameDay = [
|
||||
{ animal_id: 'z1', date: '2026-07-01T08:00:00Z', analysis_summary: { total: 1 } },
|
||||
{ animal_id: 'z1', date: '2026-07-01T20:00:00Z', analysis_summary: { total: 2 } },
|
||||
];
|
||||
const idx = buildSampleIndex(sameDay, '__days__', []);
|
||||
expect(idx.get('z1').has(1)).toBe(true);
|
||||
expect(idx.get('z1').has(2)).toBe(true);
|
||||
expect(idx.get('z1').has(3)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
import { buildSubjectSeriesMatrix } from '../src/lib/dataExport';
|
||||
|
||||
Reference in New Issue
Block a user