Skip to content

Commit 2eaa7ab

Browse files
committed
add more tests
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
1 parent 9807a80 commit 2eaa7ab

File tree

6 files changed

+32
-24
lines changed

6 files changed

+32
-24
lines changed

public/pages/DefineDetector/components/CustomResultIndex/CustomResultIndex.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function CustomResultIndex(props: CustomResultIndexProps) {
180180
id="resultIndexMinSize"
181181
placeholder="Max index size"
182182
data-test-subj="resultIndexMinSize"
183-
min={1}
183+
min={1000}
184184
{...field}
185185
/>
186186
</EuiFlexItem>

public/pages/DetectorConfig/containers/__tests__/__snapshots__/DetectorConfig.test.tsx.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ exports[`<DetectorConfig /> spec renders the component 1`] = `
458458
<p
459459
class="enabled"
460460
>
461-
7
461+
7 Days
462462
</p>
463463
</div>
464464
</div>
@@ -492,7 +492,7 @@ exports[`<DetectorConfig /> spec renders the component 1`] = `
492492
<p
493493
class="enabled"
494494
>
495-
51200
495+
51200 MB
496496
</p>
497497
</div>
498498
</div>
@@ -526,7 +526,7 @@ exports[`<DetectorConfig /> spec renders the component 1`] = `
526526
<p
527527
class="enabled"
528528
>
529-
60
529+
60 Days
530530
</p>
531531
</div>
532532
</div>
@@ -1734,7 +1734,7 @@ exports[`<DetectorConfig /> spec renders the component with 2 custom and 1 simpl
17341734
<p
17351735
class="enabled"
17361736
>
1737-
7
1737+
7 Days
17381738
</p>
17391739
</div>
17401740
</div>
@@ -1768,7 +1768,7 @@ exports[`<DetectorConfig /> spec renders the component with 2 custom and 1 simpl
17681768
<p
17691769
class="enabled"
17701770
>
1771-
51200
1771+
51200 MB
17721772
</p>
17731773
</div>
17741774
</div>
@@ -1802,7 +1802,7 @@ exports[`<DetectorConfig /> spec renders the component with 2 custom and 1 simpl
18021802
<p
18031803
class="enabled"
18041804
>
1805-
60
1805+
60 Days
18061806
</p>
18071807
</div>
18081808
</div>

public/pages/ReviewAndCreate/components/DetectorDefinitionFields/DetectorDefinitionFields.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,19 @@ export const DetectorDefinitionFields = (
220220
<EuiFlexItem>
221221
<ConfigCell
222222
title="Custom result index min age"
223-
description={get(props, 'detector.resultIndexMinAge', '-')}
223+
description={get(props, 'detector.resultIndexMinAge', '-') + ' Days'}
224224
/>
225225
</EuiFlexItem>
226226
<EuiFlexItem>
227227
<ConfigCell
228228
title="Custom result index min size"
229-
description={get(props, 'detector.resultIndexMinSize', '-')}
229+
description={get(props, 'detector.resultIndexMinSize', '-') + ' MB'}
230230
/>
231231
</EuiFlexItem>
232232
<EuiFlexItem>
233233
<ConfigCell
234234
title="Custom result index TTL"
235-
description={get(props, 'detector.resultIndexTtl', '-')}
235+
description={get(props, 'detector.resultIndexTtl', '-') + ' Days'}
236236
/>
237237
</EuiFlexItem>
238238
</EuiFlexGrid>

public/pages/ReviewAndCreate/components/__tests__/DetectorDefinitionFields.test.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const testDetector = {
5454
},
5555
],
5656
},
57+
resultIndex: 'opensearch-ad-plugin-result-test',
58+
resultIndexMinAge: 7,
59+
resultIndexMinSize: 51200,
60+
resultIndexTtl: 60,
5761
} as Detector;
5862

5963
describe('<AdditionalSettings /> spec', () => {
@@ -80,6 +84,10 @@ describe('<AdditionalSettings /> spec', () => {
8084
getByText('test-description');
8185
getByText('test-timefield');
8286
getByText('1 Minutes');
87+
getByText('opensearch-ad-plugin-result-test');
88+
getByText('7 Days');
89+
getByText('51200 MB');
90+
getByText('60 Days');
8391
expect(queryByText('test-id')).toBeNull();
8492
});
8593
test('renders the component in edit mode (with ID)', () => {

public/pages/ReviewAndCreate/components/__tests__/__snapshots__/DetectorDefinitionFields.test.tsx.snap

+8-8
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ exports[`<AdditionalSettings /> spec renders the component in create mode (no ID
336336
<p
337337
class="enabled"
338338
>
339-
-
339+
opensearch-ad-plugin-result-test
340340
</p>
341341
</div>
342342
</div>
@@ -370,7 +370,7 @@ exports[`<AdditionalSettings /> spec renders the component in create mode (no ID
370370
<p
371371
class="enabled"
372372
>
373-
-
373+
7 Days
374374
</p>
375375
</div>
376376
</div>
@@ -404,7 +404,7 @@ exports[`<AdditionalSettings /> spec renders the component in create mode (no ID
404404
<p
405405
class="enabled"
406406
>
407-
-
407+
51200 MB
408408
</p>
409409
</div>
410410
</div>
@@ -438,7 +438,7 @@ exports[`<AdditionalSettings /> spec renders the component in create mode (no ID
438438
<p
439439
class="enabled"
440440
>
441-
-
441+
60 Days
442442
</p>
443443
</div>
444444
</div>
@@ -856,7 +856,7 @@ exports[`<AdditionalSettings /> spec renders the component in edit mode (with ID
856856
<p
857857
class="enabled"
858858
>
859-
-
859+
opensearch-ad-plugin-result-test
860860
</p>
861861
</div>
862862
</div>
@@ -890,7 +890,7 @@ exports[`<AdditionalSettings /> spec renders the component in edit mode (with ID
890890
<p
891891
class="enabled"
892892
>
893-
-
893+
7 Days
894894
</p>
895895
</div>
896896
</div>
@@ -924,7 +924,7 @@ exports[`<AdditionalSettings /> spec renders the component in edit mode (with ID
924924
<p
925925
class="enabled"
926926
>
927-
-
927+
51200 MB
928928
</p>
929929
</div>
930930
</div>
@@ -958,7 +958,7 @@ exports[`<AdditionalSettings /> spec renders the component in edit mode (with ID
958958
<p
959959
class="enabled"
960960
>
961-
-
961+
60 Days
962962
</p>
963963
</div>
964964
</div>

public/pages/ReviewAndCreate/containers/__tests__/__snapshots__/ReviewAndCreate.test.tsx.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ exports[`<ReviewAndCreate /> spec renders the component, validation loading 1`]
424424
<p
425425
class="enabled"
426426
>
427-
-
427+
- Days
428428
</p>
429429
</div>
430430
</div>
@@ -458,7 +458,7 @@ exports[`<ReviewAndCreate /> spec renders the component, validation loading 1`]
458458
<p
459459
class="enabled"
460460
>
461-
-
461+
- MB
462462
</p>
463463
</div>
464464
</div>
@@ -492,7 +492,7 @@ exports[`<ReviewAndCreate /> spec renders the component, validation loading 1`]
492492
<p
493493
class="enabled"
494494
>
495-
-
495+
- Days
496496
</p>
497497
</div>
498498
</div>
@@ -1518,7 +1518,7 @@ exports[`issue in detector validation issues in feature query 1`] = `
15181518
<p
15191519
class="enabled"
15201520
>
1521-
-
1521+
- Days
15221522
</p>
15231523
</div>
15241524
</div>
@@ -1552,7 +1552,7 @@ exports[`issue in detector validation issues in feature query 1`] = `
15521552
<p
15531553
class="enabled"
15541554
>
1555-
-
1555+
- MB
15561556
</p>
15571557
</div>
15581558
</div>
@@ -1586,7 +1586,7 @@ exports[`issue in detector validation issues in feature query 1`] = `
15861586
<p
15871587
class="enabled"
15881588
>
1589-
-
1589+
- Days
15901590
</p>
15911591
</div>
15921592
</div>

0 commit comments

Comments
 (0)