File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
test/tools/unified-spec-runner Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
1919 ConnectionPoolCreatedEvent ,
2020 ConnectionReadyEvent
2121} from '../../../src/cmap/connection_pool_events' ;
22+ import { ejson } from '../utils' ;
2223import { CmapEvent , CommandEvent , EntitiesMap } from './entities' ;
2324import { ExpectedCmapEvent , ExpectedCommandEvent , ExpectedError } from './schema' ;
2425
@@ -253,12 +254,14 @@ export function specialCheck(
253254 } else if ( isExistsOperator ( expected ) ) {
254255 // $$exists
255256 const actualExists = actual !== undefined && actual !== null ;
256- expect (
257- ( expected . $$exists && actualExists ) || ( ! expected . $$exists && ! actualExists ) ,
258- `expected value at ${ path . join ( '' ) } to not exist, but received ${ JSON . stringify (
259- actual
260- ) } instead`
261- ) . to . be . true ;
257+
258+ if ( expected . $$exists ) {
259+ expect ( actualExists , ejson `expected value at path ${ path . join } to exist, but received ${ actual } ` )
260+ . to . be . true ;
261+ } else {
262+ expect ( actualExists , ejson `expected value at path ${ path . join } NOT to exist, but received ${ actual } ` )
263+ . to . be . false ;
264+ }
262265 } else {
263266 expect . fail ( `Unknown special operator: ${ JSON . stringify ( expected ) } ` ) ;
264267 }
You can’t perform that action at this time.
0 commit comments