CaCu's page by readings, screening stages, ages and exports
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { bars } from './bars';
|
||||
import { Reading } from './measures';
|
||||
|
||||
describe('bars', () => {
|
||||
it('list every category, so the shares add up', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: {
|
||||
category: { a: { 'initial-population': 3 }, other: { 'initial-population': 1 } },
|
||||
},
|
||||
};
|
||||
const catalog = [{ code: 'a', label: 'A', color: '#000' }];
|
||||
const t = bars({ kind: 'counts', label: 'x', measure: 'M', catalog }, () => r)!;
|
||||
expect(t.rows.map((x) => x.cells)).toEqual([
|
||||
['3', '75.0 %'],
|
||||
['1', '25.0 %'],
|
||||
]);
|
||||
});
|
||||
it('a group with no patients has no rate', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: { s: { initial: { numerator: 0, denominator: 0 } } },
|
||||
};
|
||||
const mode = { kind: 'shares', label: 'x', measure: 'M', stratum: 's', order: ['initial'] };
|
||||
expect(bars(mode as any, () => r)!.rows[0].cells).toEqual(['0/0', '—']);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user