@@ -5,46 +5,72 @@ import { pipettingLossTableColumn } from './pipettingLossTableColumn';
5
5
6
6
describe ( 'pipettingLossTableColumn' , ( ) => {
7
7
describe ( 'with "absolute" pipetting loss type' , ( ) => {
8
- it ( 'should display the correct tooltip content ' , ( ) => {
8
+ it ( 'should render the total volume and title correctly ' , ( ) => {
9
9
const column = pipettingLossTableColumn ( {
10
10
count : 2 ,
11
11
pipettingLoss : { type : 'absolute' , count : 1 } ,
12
12
} ) ;
13
+ render ( < > { column . render ( null , { volume : 10 , title : '' , key : 1 } , 1 ) } </ > ) ;
13
14
render ( < > { column . title } </ > ) ;
14
15
16
+ expect ( screen . getByText ( '30.0 µl' ) ) . toBeInTheDocument ( ) ;
15
17
expect ( screen . getByText ( '2x Ansätze + 1x (PV)' ) ) . toBeInTheDocument ( ) ;
16
18
} ) ;
19
+ } ) ;
17
20
18
- it ( 'should render the total volume correctly' , ( ) => {
21
+ describe ( 'with "factor" pipetting loss type' , ( ) => {
22
+ it ( 'should render the total volume and title correctly' , ( ) => {
19
23
const column = pipettingLossTableColumn ( {
20
24
count : 2 ,
21
- pipettingLoss : { type : 'absolute ' , count : 1 } ,
25
+ pipettingLoss : { type : 'factor ' , factor : 0. 1 } ,
22
26
} ) ;
23
27
render ( < > { column . render ( null , { volume : 10 , title : '' , key : 1 } , 1 ) } </ > ) ;
28
+ render ( < > { column . title } </ > ) ;
24
29
25
- expect ( screen . getByText ( '30.0 µl' ) ) . toBeInTheDocument ( ) ;
30
+ expect ( screen . getByText ( '22.0 µl' ) ) . toBeInTheDocument ( ) ;
31
+ expect ( screen . getByText ( '2x Ansätze + 10% (PV)' ) ) . toBeInTheDocument ( ) ;
26
32
} ) ;
27
33
} ) ;
28
34
29
- describe ( 'with "factor" pipetting loss type' , ( ) => {
30
- it ( 'should display the correct tooltip content' , ( ) => {
35
+ describe ( 'with "factorWithMinimum" pipetting loss type' , ( ) => {
36
+ it ( 'should use minimum positions when factor loss is slightly below minimum positions' , ( ) => {
37
+ // 19 ansätze × 10µl = 190µl
38
+ // factor loss: 190µl × 10% = 19µl
39
+ // min positions loss: 2 × 10µl = 20µl
40
+ // result: 190µl + max(19µl, 20µl) = 210µl
31
41
const column = pipettingLossTableColumn ( {
32
- count : 2 ,
33
- pipettingLoss : { type : 'factor' , factor : 0.1 } ,
42
+ count : 19 ,
43
+ pipettingLoss : {
44
+ type : 'factorWithMinimum' ,
45
+ factor : 0.1 ,
46
+ minPositions : 2 ,
47
+ } ,
34
48
} ) ;
35
49
render ( < > { column . title } </ > ) ;
50
+ render ( < > { column . render ( null , { volume : 10 , title : '' , key : 1 } , 1 ) } </ > ) ;
36
51
37
- expect ( screen . getByText ( '2x Ansätze + 10% (PV)' ) ) . toBeInTheDocument ( ) ;
52
+ expect ( screen . getByText ( '210.0 µl' ) ) . toBeInTheDocument ( ) ;
53
+ expect ( screen . getByText ( '19x Ansätze + 2x (PV)' ) ) . toBeInTheDocument ( ) ;
38
54
} ) ;
39
55
40
- it ( 'should render the total volume correctly' , ( ) => {
56
+ it ( 'should use factor loss when it is slightly above minimum positions' , ( ) => {
57
+ // 21 ansätze × 10µl = 210µl
58
+ // factor loss: 210µl × 10% = 21µl
59
+ // min positions loss: 2 × 10µl = 20µl
60
+ // result: 210µl + max(21µl, 20µl) = 231µl
41
61
const column = pipettingLossTableColumn ( {
42
- count : 2 ,
43
- pipettingLoss : { type : 'factor' , factor : 0.1 } ,
62
+ count : 21 ,
63
+ pipettingLoss : {
64
+ type : 'factorWithMinimum' ,
65
+ factor : 0.1 ,
66
+ minPositions : 2 ,
67
+ } ,
44
68
} ) ;
69
+ render ( < > { column . title } </ > ) ;
45
70
render ( < > { column . render ( null , { volume : 10 , title : '' , key : 1 } , 1 ) } </ > ) ;
46
71
47
- expect ( screen . getByText ( '22.0 µl' ) ) . toBeInTheDocument ( ) ;
72
+ expect ( screen . getByText ( '231.0 µl' ) ) . toBeInTheDocument ( ) ;
73
+ expect ( screen . getByText ( '21x Ansätze + 10% (PV)' ) ) . toBeInTheDocument ( ) ;
48
74
} ) ;
49
75
} ) ;
50
76
} ) ;
0 commit comments