@@ -92,6 +92,12 @@ test("scoreItem", () => {
92
92
) ;
93
93
expect ( pathIdentity . rawValueMatch ) . toBeUndefined ( ) ;
94
94
expect ( pathIdentity . formattedValueMatch ) . toBeUndefined ( ) ;
95
+ expect ( pathIdentity . label ) . toBe ( "someKey123" ) ;
96
+ expect ( pathIdentity . description ) . toBe ( "xyz.some.path" ) ;
97
+ expect ( pathIdentity . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
98
+ expect ( pathIdentity . formattedValue ) . toBe (
99
+ "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ,
100
+ ) ;
95
101
96
102
const labelPrefix = scoreItem ( jsonPath , "som" , true , jsonHeroPathAccessor ) ;
97
103
expect ( labelPrefix . score ) . toBeGreaterThan ( 0 ) ;
@@ -101,6 +107,12 @@ test("scoreItem", () => {
101
107
expect ( labelPrefix . labelMatch ?. length ) . toBe ( 1 ) ;
102
108
expect ( labelPrefix . labelMatch ?. [ 0 ] . start ) . toBe ( 0 ) ;
103
109
expect ( labelPrefix . labelMatch ?. [ 0 ] . end ) . toBe ( "som" . length ) ;
110
+ expect ( labelPrefix . label ) . toBe ( "someKey123" ) ;
111
+ expect ( labelPrefix . description ) . toBe ( "xyz.some.path" ) ;
112
+ expect ( labelPrefix . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
113
+ expect ( labelPrefix . formattedValue ) . toBe (
114
+ "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ,
115
+ ) ;
104
116
105
117
const labelCamelcase = scoreItem ( jsonPath , "sK" , true , jsonHeroPathAccessor ) ;
106
118
expect ( labelCamelcase . score ) . toBeGreaterThan ( 0 ) ;
@@ -112,6 +124,12 @@ test("scoreItem", () => {
112
124
expect ( labelCamelcase . labelMatch ?. [ 0 ] . end ) . toBe ( 1 ) ;
113
125
expect ( labelCamelcase . labelMatch ?. [ 1 ] . start ) . toBe ( 4 ) ;
114
126
expect ( labelCamelcase . labelMatch ?. [ 1 ] . end ) . toBe ( 5 ) ;
127
+ expect ( labelCamelcase . label ) . toBe ( "someKey123" ) ;
128
+ expect ( labelCamelcase . description ) . toBe ( "xyz.some.path" ) ;
129
+ expect ( labelCamelcase . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
130
+ expect ( labelCamelcase . formattedValue ) . toBe (
131
+ "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ,
132
+ ) ;
115
133
116
134
const labelMatch = scoreItem ( jsonPath , "ok" , true , jsonHeroPathAccessor ) ;
117
135
expect ( labelMatch . score ) . toBeGreaterThan ( 0 ) ;
@@ -123,6 +141,10 @@ test("scoreItem", () => {
123
141
expect ( labelMatch . labelMatch ?. [ 0 ] . end ) . toBe ( 2 ) ;
124
142
expect ( labelMatch . labelMatch ?. [ 1 ] . start ) . toBe ( 4 ) ;
125
143
expect ( labelMatch . labelMatch ?. [ 1 ] . end ) . toBe ( 5 ) ;
144
+ expect ( labelMatch . label ) . toBe ( "someKey123" ) ;
145
+ expect ( labelMatch . description ) . toBe ( "xyz.some.path" ) ;
146
+ expect ( labelMatch . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
147
+ expect ( labelMatch . formattedValue ) . toBe ( "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ) ;
126
148
127
149
const pathMatch = scoreItem ( jsonPath , "xyz123" , true , jsonHeroPathAccessor ) ;
128
150
expect ( pathMatch . score ) . toBeGreaterThan ( 0 ) ;
@@ -133,6 +155,10 @@ test("scoreItem", () => {
133
155
expect ( pathMatch . labelMatch ?. length ) . toBe ( 1 ) ;
134
156
expect ( pathMatch . labelMatch ?. [ 0 ] . start ) . toBe ( 7 ) ;
135
157
expect ( pathMatch . labelMatch ?. [ 0 ] . end ) . toBe ( 10 ) ;
158
+ expect ( pathMatch . label ) . toBe ( "someKey123" ) ;
159
+ expect ( pathMatch . description ) . toBe ( "xyz.some.path" ) ;
160
+ expect ( pathMatch . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
161
+ expect ( pathMatch . formattedValue ) . toBe ( "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ) ;
136
162
137
163
const rawValueMatch = scoreItem ( jsonPath , "-" , true , jsonHeroPathAccessor ) ;
138
164
expect ( rawValueMatch . score ) . toBeGreaterThan ( 0 ) ;
@@ -143,6 +169,12 @@ test("scoreItem", () => {
143
169
expect ( rawValueMatch . rawValueMatch ?. length ) . toBe ( 1 ) ;
144
170
expect ( rawValueMatch . rawValueMatch ?. [ 0 ] . start ) . toBe ( 7 ) ;
145
171
expect ( rawValueMatch . rawValueMatch ?. [ 0 ] . end ) . toBe ( 8 ) ;
172
+ expect ( rawValueMatch . label ) . toBe ( "someKey123" ) ;
173
+ expect ( rawValueMatch . description ) . toBe ( "xyz.some.path" ) ;
174
+ expect ( rawValueMatch . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
175
+ expect ( rawValueMatch . formattedValue ) . toBe (
176
+ "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ,
177
+ ) ;
146
178
147
179
const formattedValueMatch = scoreItem ( jsonPath , "wich" , true , jsonHeroPathAccessor ) ;
148
180
expect ( formattedValueMatch . score ) . toBeGreaterThan ( 0 ) ;
@@ -153,6 +185,12 @@ test("scoreItem", () => {
153
185
expect ( formattedValueMatch . formattedValueMatch ?. length ) . toBe ( 1 ) ;
154
186
expect ( formattedValueMatch . formattedValueMatch ?. [ 0 ] . start ) . toBe ( 40 ) ;
155
187
expect ( formattedValueMatch . formattedValueMatch ?. [ 0 ] . end ) . toBe ( 44 ) ;
188
+ expect ( formattedValueMatch . label ) . toBe ( "someKey123" ) ;
189
+ expect ( formattedValueMatch . description ) . toBe ( "xyz.some.path" ) ;
190
+ expect ( formattedValueMatch . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
191
+ expect ( formattedValueMatch . formattedValue ) . toBe (
192
+ "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ,
193
+ ) ;
156
194
157
195
const valueMatch = scoreItem ( jsonPath , "2022" , true , jsonHeroPathAccessor ) ;
158
196
expect ( valueMatch . score ) . toBeGreaterThan ( 0 ) ;
@@ -166,6 +204,10 @@ test("scoreItem", () => {
166
204
expect ( valueMatch . formattedValueMatch ?. length ) . toBe ( 1 ) ;
167
205
expect ( valueMatch . formattedValueMatch ?. [ 0 ] . start ) . toBe ( 11 ) ;
168
206
expect ( valueMatch . formattedValueMatch ?. [ 0 ] . end ) . toBe ( 15 ) ;
207
+ expect ( valueMatch . label ) . toBe ( "someKey123" ) ;
208
+ expect ( valueMatch . description ) . toBe ( "xyz.some.path" ) ;
209
+ expect ( valueMatch . rawValue ) . toBe ( "2022-01-01T00:00:00.000Z" ) ;
210
+ expect ( valueMatch . formattedValue ) . toBe ( "Sat Jan 01 2022 00:00:00 GMT+0000 (Greenwich Mean Time)" ) ;
169
211
170
212
// No Match
171
213
const noMatch = scoreItem ( jsonPath , "987" , true , jsonHeroPathAccessor ) ;
0 commit comments