improvement: fdi tooth chart selection modes polished. bugs related to teeth selecyion fixed.
This commit is contained in:
@@ -172,7 +172,7 @@ describe('generateLabCaseTasks', () => {
|
||||
expect(stepCodes).toContain('printer_resin');
|
||||
});
|
||||
|
||||
it('keeps separate selection groups with the same prosthesis type as separate task sets', async () => {
|
||||
it('merges teeth with the same prosthesis type across selection groups', async () => {
|
||||
const pfmSteps = stepsFromSeed('pfm_crown');
|
||||
const { tx, created } = buildMockTx({
|
||||
toothProsthesisRows: [
|
||||
@@ -198,21 +198,13 @@ describe('generateLabCaseTasks', () => {
|
||||
prosthesisTypes: [{ code: 'pfm_crown', steps: pfmSteps }],
|
||||
});
|
||||
|
||||
const count = await generateLabCaseTasks(tx as never, 'lab-case-split', 'en');
|
||||
expect(count).toBe(pfmSteps.length * 2);
|
||||
const rows = created as Array<{
|
||||
teeth: string[];
|
||||
selectionGroupId: string;
|
||||
prosthesisTypeCode: string;
|
||||
}>;
|
||||
const connected = rows.filter((r) => r.selectionGroupId === 'connected-1');
|
||||
const single = rows.filter((r) => r.selectionGroupId === 'single-21');
|
||||
expect(connected).toHaveLength(pfmSteps.length);
|
||||
expect(single).toHaveLength(pfmSteps.length);
|
||||
expect(connected.every((r) => JSON.stringify(r.teeth) === JSON.stringify(['14', '15']))).toBe(
|
||||
const count = await generateLabCaseTasks(tx as never, 'lab-case-merge', 'en');
|
||||
expect(count).toBe(pfmSteps.length);
|
||||
const rows = created as Array<{ teeth: string[]; prosthesisTypeCode: string }>;
|
||||
expect(rows).toHaveLength(pfmSteps.length);
|
||||
expect(rows.every((r) => JSON.stringify(r.teeth) === JSON.stringify(['14', '15', '21']))).toBe(
|
||||
true,
|
||||
);
|
||||
expect(single.every((r) => JSON.stringify(r.teeth) === JSON.stringify(['21']))).toBe(true);
|
||||
});
|
||||
|
||||
it('skips generation when tasks already exist', async () => {
|
||||
|
||||
Reference in New Issue
Block a user