@@ -159,15 +159,14 @@ describe('[#20481] the write door — a date string is written in its YYYY-MM-DD
159159 }
160160 } ) ;
161161
162- it ( 'one reading at both doors: every refused string is refused as a comparand too, and every accepted string is read as one' , async ( ) => {
163- for ( const value of REFUSED ) {
162+ it ( 'one reading at both doors: a date string is refused as a written value exactly when it is refused as a comparand' , async ( ) => {
163+ const strings = [ ...REFUSED , ...ACCEPTED . map ( ( [ , v ] ) => v ) . filter ( ( v ) : v is string => typeof v === 'string' ) ] ;
164+ for ( const value of strings ) {
165+ const written = ( await engine . validate ( 'ledger' , { placed_on : value } ) ) . valid ;
164166 const err = await refusalOf ( engine . find ( 'ledger' , { where : { placed_on : { $gte : value } } } ) ) ;
165- expect ( err , `where ${ value } ` ) . toMatchObject ( { code : 'INVALID_FILTER' , status : 400 } ) ;
167+ if ( err ) expect ( err , `where ${ JSON . stringify ( value ) } ` ) . toMatchObject ( { code : 'INVALID_FILTER' , status : 400 } ) ;
168+ expect ( { written, compared : err === null } , JSON . stringify ( value ) ) . toEqual ( { written : ! REFUSED . includes ( value ) , compared : ! REFUSED . includes ( value ) } ) ;
166169 }
167- expect ( reads , 'no read — every comparand refusal precedes the driver' ) . toHaveLength ( 0 ) ;
168- for ( const [ name , value ] of ACCEPTED ) {
169- await expect ( engine . find ( 'ledger' , { where : { placed_on : { $gte : value } } } ) , `where ${ name } ` ) . resolves . toEqual ( [ ] ) ;
170- }
171- expect ( reads ) . toHaveLength ( ACCEPTED . length ) ;
170+ expect ( reads , 'a read for each accepted comparand, none for a refused one' ) . toHaveLength ( strings . length - REFUSED . length ) ;
172171 } ) ;
173172} ) ;
0 commit comments