File tree Expand file tree Collapse file tree
src/views/Generator/TestRuleContainer/TestRule Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 CorrelationRule ,
33 CustomCodeRule ,
44 TestRule ,
5- VerificationRule ,
65 ParameterizationRule ,
76} from '@/types/rules'
87import { TestRuleFilter } from './TestRuleFilter'
@@ -13,8 +12,8 @@ import {
1312 BorderLeftIcon ,
1413 BorderRightIcon ,
1514 EyeOpenIcon ,
16- DiscIcon ,
1715} from '@radix-ui/react-icons'
16+ import { VerificationContent } from './VerificationContent'
1817
1918interface TestRuleInlineContentProps {
2019 rule : TestRule
@@ -35,19 +34,6 @@ export function TestRuleInlineContent({ rule }: TestRuleInlineContentProps) {
3534 }
3635}
3736
38- function VerificationContent ( { rule } : { rule : VerificationRule } ) {
39- return (
40- < >
41- < TestRuleFilter filter = { rule . filter } /> { ' ' }
42- < Tooltip content = "Checks that all request statuses match the recording." >
43- < Badge color = "gray" >
44- < DiscIcon /> Recording
45- </ Badge >
46- </ Tooltip >
47- </ >
48- )
49- }
50-
5137function CorrelationContent ( { rule } : { rule : CorrelationRule } ) {
5238 return (
5339 < >
Original file line number Diff line number Diff line change 1+ import { VerificationRule } from '@/types/rules'
2+ import { TestRuleFilter } from './TestRuleFilter'
3+ import { Badge , Strong } from '@radix-ui/themes'
4+ import { exhaustive } from '@/utils/typescript'
5+ import { Link1Icon } from '@radix-ui/react-icons'
6+
7+ export function VerificationContent ( { rule } : { rule : VerificationRule } ) {
8+ return (
9+ < >
10+ < TestRuleFilter filter = { rule . filter } />
11+ < Badge color = "gray" >
12+ Verify < Strong > { rule . target } </ Strong > { ' ' }
13+ < OperatorLabel operator = { rule . operator } /> < ValueLabel rule = { rule } />
14+ </ Badge >
15+ </ >
16+ )
17+ }
18+
19+ function OperatorLabel ( {
20+ operator,
21+ } : {
22+ operator : VerificationRule [ 'operator' ]
23+ } ) {
24+ switch ( operator ) {
25+ case 'equals' :
26+ case 'contains' :
27+ return operator
28+ case 'notContains' :
29+ return 'does not contain'
30+ default :
31+ return exhaustive ( operator )
32+ }
33+ }
34+
35+ function ValueLabel ( { rule } : { rule : VerificationRule } ) {
36+ switch ( rule . value . type ) {
37+ case 'recordedValue' :
38+ return < Strong > recorded value</ Strong >
39+ case 'string' :
40+ return < Strong > { rule . value . value } </ Strong >
41+ case 'variable' :
42+ return (
43+ < Strong >
44+ < Link1Icon css = { { verticalAlign : 'middle' , display : 'inline' } } /> { ' ' }
45+ { rule . value . variableName }
46+ </ Strong >
47+ )
48+ default :
49+ return exhaustive ( rule . value )
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments