@@ -162,22 +162,26 @@ describe("inference", async () => {
162162 const simpleFieldStr = fields . getSimpleField ( "field_simple_string" ) ;
163163 expect ( simpleFieldStr . value ) . to . be . eq ( "field_simple_string-value" ) ;
164164 expect ( simpleFieldStr . stringValue ) . to . be . eq ( "field_simple_string-value" ) ;
165+ expect ( simpleFieldStr . confidence ) . to . be . eq ( FieldConfidence . Certain ) ;
165166 expect ( ( ) => simpleFieldStr . numberValue ) . to . throw ( "Value is not a number" ) ;
166167 expect ( ( ) => simpleFieldStr . booleanValue ) . to . throw ( "Value is not a boolean" ) ;
167168
168169 expect ( fields . get ( "field_simple_float" ) ) . to . be . instanceOf ( SimpleField ) ;
169170 const simpleFieldFloat = fields . getSimpleField ( "field_simple_float" ) ;
170171 expect ( simpleFieldFloat . value ) . to . be . eq ( 1.1 ) ;
171172 expect ( simpleFieldFloat . numberValue ) . to . be . eq ( 1.1 ) ;
173+ expect ( simpleFieldFloat . confidence ) . to . be . eq ( FieldConfidence . High ) ;
172174 expect ( ( ) => simpleFieldFloat . stringValue ) . to . throw ( "Value is not a string" ) ;
173175 expect ( ( ) => simpleFieldFloat . booleanValue ) . to . throw ( "Value is not a boolean" ) ;
174176
175177 expect ( fields . get ( "field_simple_int" ) ) . to . be . instanceOf ( SimpleField ) ;
176178 const simpleFieldInt = fields . getSimpleField ( "field_simple_int" ) ;
179+ expect ( simpleFieldInt . confidence ) . to . be . eq ( FieldConfidence . Medium ) ;
177180 expect ( simpleFieldInt . value ) . to . be . eq ( 12.0 ) ;
178181
179182 expect ( fields . get ( "field_simple_zero" ) ) . to . be . instanceOf ( SimpleField ) ;
180183 const simpleFieldZero = fields . getSimpleField ( "field_simple_zero" ) ;
184+ expect ( simpleFieldZero . confidence ) . to . be . eq ( FieldConfidence . Low ) ;
181185 expect ( simpleFieldZero . value ) . to . be . eq ( 0 ) ;
182186 expect ( simpleFieldZero . numberValue ) . to . be . eq ( 0 ) ;
183187
@@ -223,6 +227,7 @@ describe("inference", async () => {
223227
224228 const subField1 = subFields . get ( "subfield_1" ) ;
225229 expect ( subField1 ?. value ) . to . be . not . null ;
230+ expect ( subField1 ?. confidence ) . to . be . eq ( FieldConfidence . High ) ;
226231
227232 subFields . forEach ( ( subField , fieldName ) => {
228233 expect ( fieldName . startsWith ( "subfield_" ) ) . to . be . true ;
@@ -308,11 +313,18 @@ describe("inference", async () => {
308313 expect ( polygon [ 3 ] [ 0 ] ) . to . equal ( 0.948849 ) ;
309314 expect ( polygon [ 3 ] [ 1 ] ) . to . equal ( 0.244565 ) ;
310315
311- const isCertainEnum = dateField . confidence === FieldConfidence . Medium ;
312- expect ( isCertainEnum ) . to . be . true ;
316+ const eqConfidenceEnum = dateField . confidence === FieldConfidence . Medium ;
317+ expect ( eqConfidenceEnum ) . to . be . true ;
313318
314- const isCertainStr = dateField . confidence === "Medium" ;
315- expect ( isCertainStr ) . to . be . true ;
319+ expect ( dateField . confidence === "Medium" ) . to . be . true ;
320+ expect ( FieldConfidence . toInt ( dateField . confidence ) === 2 ) . to . be . true ;
321+
322+ expect ( FieldConfidence . greaterThan ( dateField . confidence , FieldConfidence . Low ) ) . to . be . true ;
323+ expect ( FieldConfidence . greaterThanOrEqual ( dateField . confidence , FieldConfidence . Low ) ) . to . be . true ;
324+ expect ( FieldConfidence . greaterThanOrEqual ( dateField . confidence , FieldConfidence . Medium ) ) . to . be . true ;
325+ expect ( FieldConfidence . lessThanOrEqual ( dateField . confidence , FieldConfidence . Medium ) ) . to . be . true ;
326+ expect ( FieldConfidence . lessThanOrEqual ( dateField . confidence , FieldConfidence . Certain ) ) . to . be . true ;
327+ expect ( FieldConfidence . lessThan ( dateField . confidence , FieldConfidence . Certain ) ) . to . be . true ;
316328
317329 } ) . timeout ( 10000 ) ;
318330 } ) ;
0 commit comments