@@ -39,47 +39,47 @@ describe(ModelEvaluation.name, () => {
39
39
} ) ;
40
40
41
41
describe ( "when showEvaluationUi is true" , ( ) => {
42
- it ( "renders evaluation UI with 'Evaluate' button enabled" , ( ) => {
42
+ it ( "renders evaluation UI with 'Evaluate' button enabled" , async ( ) => {
43
43
render ( ) ;
44
44
45
- const evaluateButton = screen . queryByText ( "Evaluate" ) ;
45
+ const evaluateButton = await screen . findByText ( "Evaluate" ) ;
46
46
expect ( evaluateButton ) . toBeInTheDocument ( ) ;
47
- expect ( evaluateButton ?. getElementsByTagName ( "input" ) [ 0 ] ) . toBeEnabled ( ) ;
47
+ expect ( evaluateButton ) . toBeEnabled ( ) ;
48
48
49
49
expect ( screen . queryByText ( "Stop evaluation" ) ) . not . toBeInTheDocument ( ) ;
50
50
51
51
expect ( screen . queryByText ( "Evaluation run" ) ) . not . toBeInTheDocument ( ) ;
52
52
} ) ;
53
53
54
- it ( "disables 'Evaluate' button when there are no custom models" , ( ) => {
54
+ it ( "disables 'Evaluate' button when there are no custom models" , async ( ) => {
55
55
render ( {
56
56
modeledMethods : { } ,
57
57
} ) ;
58
58
59
- const evaluateButton = screen . queryByText ( "Evaluate" ) ;
59
+ const evaluateButton = await screen . findByText ( "Evaluate" ) ;
60
60
expect ( evaluateButton ) . toBeInTheDocument ( ) ;
61
- expect ( evaluateButton ?. getElementsByTagName ( "input" ) [ 0 ] ) . toBeDisabled ( ) ;
61
+ expect ( evaluateButton ) . toBeDisabled ( ) ;
62
62
63
63
expect ( screen . queryByText ( "Stop evaluation" ) ) . not . toBeInTheDocument ( ) ;
64
64
65
65
expect ( screen . queryByText ( "Evaluation run" ) ) . not . toBeInTheDocument ( ) ;
66
66
} ) ;
67
67
68
- it ( "disables 'Evaluate' button when there are unsaved changes" , ( ) => {
68
+ it ( "disables 'Evaluate' button when there are unsaved changes" , async ( ) => {
69
69
render ( {
70
70
modifiedSignatures : new Set ( [ method . signature ] ) ,
71
71
} ) ;
72
72
73
- const evaluateButton = screen . queryByText ( "Evaluate" ) ;
73
+ const evaluateButton = await screen . findByText ( "Evaluate" ) ;
74
74
expect ( evaluateButton ) . toBeInTheDocument ( ) ;
75
- expect ( evaluateButton ?. getElementsByTagName ( "input" ) [ 0 ] ) . toBeDisabled ( ) ;
75
+ expect ( evaluateButton ) . toBeDisabled ( ) ;
76
76
77
77
expect ( screen . queryByText ( "Stop evaluation" ) ) . not . toBeInTheDocument ( ) ;
78
78
79
79
expect ( screen . queryByText ( "Evaluation run" ) ) . not . toBeInTheDocument ( ) ;
80
80
} ) ;
81
81
82
- it ( "renders 'Evaluate' button and 'Evaluation run' link when there is a completed evaluation" , ( ) => {
82
+ it ( "renders 'Evaluate' button and 'Evaluation run' link when there is a completed evaluation" , async ( ) => {
83
83
render ( {
84
84
evaluationRun : {
85
85
isPreparing : false ,
@@ -89,35 +89,33 @@ describe(ModelEvaluation.name, () => {
89
89
} ,
90
90
} ) ;
91
91
92
- const evaluateButton = screen . queryByText ( "Evaluate" ) ;
92
+ const evaluateButton = await screen . findByText ( "Evaluate" ) ;
93
93
expect ( evaluateButton ) . toBeInTheDocument ( ) ;
94
- expect ( evaluateButton ?. getElementsByTagName ( "input" ) [ 0 ] ) . toBeEnabled ( ) ;
94
+ expect ( evaluateButton ) . toBeEnabled ( ) ;
95
95
96
96
expect ( screen . queryByText ( "Evaluation run" ) ) . toBeInTheDocument ( ) ;
97
97
98
98
expect ( screen . queryByText ( "Stop evaluation" ) ) . not . toBeInTheDocument ( ) ;
99
99
} ) ;
100
100
101
- it ( "renders 'Stop evaluation' button when there is an in progress evaluation, but no variant analysis yet" , ( ) => {
101
+ it ( "renders 'Stop evaluation' button when there is an in progress evaluation, but no variant analysis yet" , async ( ) => {
102
102
render ( {
103
103
evaluationRun : {
104
104
isPreparing : true ,
105
105
variantAnalysis : undefined ,
106
106
} ,
107
107
} ) ;
108
108
109
- const stopEvaluationButton = screen . queryByText ( "Stop evaluation" ) ;
109
+ const stopEvaluationButton = await screen . findByText ( "Stop evaluation" ) ;
110
110
expect ( stopEvaluationButton ) . toBeInTheDocument ( ) ;
111
- expect (
112
- stopEvaluationButton ?. getElementsByTagName ( "input" ) [ 0 ] ,
113
- ) . toBeEnabled ( ) ;
111
+ expect ( stopEvaluationButton ) . toBeEnabled ( ) ;
114
112
115
113
expect ( screen . queryByText ( "Evaluation run" ) ) . not . toBeInTheDocument ( ) ;
116
114
117
115
expect ( screen . queryByText ( "Evaluate" ) ) . not . toBeInTheDocument ( ) ;
118
116
} ) ;
119
117
120
- it ( "renders 'Stop evaluation' button and 'Evaluation run' link when there is an in progress evaluation with variant analysis" , ( ) => {
118
+ it ( "renders 'Stop evaluation' button and 'Evaluation run' link when there is an in progress evaluation with variant analysis" , async ( ) => {
121
119
render ( {
122
120
evaluationRun : {
123
121
isPreparing : false ,
@@ -127,11 +125,9 @@ describe(ModelEvaluation.name, () => {
127
125
} ,
128
126
} ) ;
129
127
130
- const stopEvaluationButton = screen . queryByText ( "Stop evaluation" ) ;
128
+ const stopEvaluationButton = await screen . findByText ( "Stop evaluation" ) ;
131
129
expect ( stopEvaluationButton ) . toBeInTheDocument ( ) ;
132
- expect (
133
- stopEvaluationButton ?. getElementsByTagName ( "input" ) [ 0 ] ,
134
- ) . toBeEnabled ( ) ;
130
+ expect ( stopEvaluationButton ) . toBeEnabled ( ) ;
135
131
136
132
expect ( screen . queryByText ( "Evaluation run" ) ) . toBeInTheDocument ( ) ;
137
133
0 commit comments