TreatmentType and ProsthesisType database shcema and data updated. Lab dispatch wired through new data.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { assertCompleteToothProsthesisMap } from './lab-case-send.validation';
|
||||
|
||||
describe('assertCompleteToothProsthesisMap', () => {
|
||||
const prosthesisDetailId = 'detail-1';
|
||||
|
||||
it('passes when every prosthesis tooth has a mapping', () => {
|
||||
expect(() =>
|
||||
assertCompleteToothProsthesisMap({
|
||||
details: [
|
||||
{
|
||||
treatmentDetailId: prosthesisDetailId,
|
||||
detail: { id: prosthesisDetailId, treatmentType: 'prosthesis', teeth: ['14', '15'] },
|
||||
},
|
||||
],
|
||||
toothProsthesis: [
|
||||
{ treatmentDetailId: prosthesisDetailId, tooth: '14', prosthesisTypeCode: 'pfm_crown' },
|
||||
{ treatmentDetailId: prosthesisDetailId, tooth: '15', prosthesisTypeCode: 'pfm_crown' },
|
||||
],
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('ignores non-prosthesis details', () => {
|
||||
expect(() =>
|
||||
assertCompleteToothProsthesisMap({
|
||||
details: [
|
||||
{
|
||||
treatmentDetailId: 'endo-1',
|
||||
detail: { id: 'endo-1', treatmentType: 'endo', teeth: ['36'] },
|
||||
},
|
||||
],
|
||||
toothProsthesis: [],
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('throws when a prosthesis tooth is missing from the map', () => {
|
||||
expect(() =>
|
||||
assertCompleteToothProsthesisMap({
|
||||
details: [
|
||||
{
|
||||
treatmentDetailId: prosthesisDetailId,
|
||||
detail: { id: prosthesisDetailId, treatmentType: 'prosthesis', teeth: ['14', '15'] },
|
||||
},
|
||||
],
|
||||
toothProsthesis: [
|
||||
{ treatmentDetailId: prosthesisDetailId, tooth: '14', prosthesisTypeCode: 'pfm_crown' },
|
||||
],
|
||||
}),
|
||||
).toThrow('missing tooth 15');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user