@@ -1862,27 +1862,35 @@ describe('Change Streams', function () {
1862
1862
1863
1863
await collection . insertOne ( { a : 1 } ) ;
1864
1864
const change = await changeStream . next ( ) ;
1865
- expect ( change ) . to . have . property ( 'operationType' , 'insert' ) ;
1866
- expect ( change ) . to . have . nested . property ( 'fullDocument.a' , 1 ) ;
1865
+ expect ( change ) . to . containSubset ( {
1866
+ operationType : 'insert' ,
1867
+ fullDocument : { a : 1 }
1868
+ } ) ;
1867
1869
1868
1870
await collection . insertOne ( { a : 2 } ) ;
1869
1871
const change2 = await changeStream . next ( ) ;
1870
- expect ( change2 ) . to . have . property ( 'operationType' , 'insert' ) ;
1871
- expect ( change2 ) . to . have . nested . property ( 'fullDocument.a' , 2 ) ;
1872
+ expect ( change2 ) . to . containSubset ( {
1873
+ operationType : 'insert' ,
1874
+ fullDocument : { a : 2 }
1875
+ } ) ;
1872
1876
} ) ;
1873
1877
1874
1878
it ( '#tryNext' , { requires : { topology : 'replicaset' } } , async function test ( ) {
1875
1879
await initIteratorMode ( changeStream ) ;
1876
1880
1877
1881
await collection . insertOne ( { a : 1 } ) ;
1878
1882
const change = await changeStream . tryNext ( ) ;
1879
- expect ( change ) . to . have . property ( 'operationType' , 'insert' ) ;
1880
- expect ( change ) . to . have . nested . property ( 'fullDocument.a' , 1 ) ;
1883
+ expect ( change ) . to . containSubset ( {
1884
+ operationType : 'insert' ,
1885
+ fullDocument : { a : 1 }
1886
+ } ) ;
1881
1887
1882
1888
await collection . insertOne ( { a : 2 } ) ;
1883
1889
const change2 = await changeStream . tryNext ( ) ;
1884
- expect ( change2 ) . to . have . property ( 'operationType' , 'insert' ) ;
1885
- expect ( change2 ) . to . have . nested . property ( 'fullDocument.a' , 2 ) ;
1890
+ expect ( change2 ) . to . containSubset ( {
1891
+ operationType : 'insert' ,
1892
+ fullDocument : { a : 2 }
1893
+ } ) ;
1886
1894
} ) ;
1887
1895
} ) ;
1888
1896
@@ -1892,13 +1900,17 @@ describe('Change Streams', function () {
1892
1900
1893
1901
await collection . insertOne ( { a : 1 } ) ;
1894
1902
const change = await willBeChange . next ( ) ;
1895
- expect ( change . value [ 0 ] ) . to . have . property ( 'operationType' , 'insert' ) ;
1896
- expect ( change . value [ 0 ] ) . to . have . nested . property ( 'fullDocument.a' , 1 ) ;
1903
+ expect ( change . value [ 0 ] ) . to . containSubset ( {
1904
+ operationType : 'insert' ,
1905
+ fullDocument : { a : 1 }
1906
+ } ) ;
1897
1907
1898
1908
await collection . insertOne ( { a : 2 } ) ;
1899
1909
const change2 = await willBeChange . next ( ) ;
1900
- expect ( change2 . value [ 0 ] ) . to . have . property ( 'operationType' , 'insert' ) ;
1901
- expect ( change2 . value [ 0 ] ) . to . have . nested . property ( 'fullDocument.a' , 2 ) ;
1910
+ expect ( change2 . value [ 0 ] ) . to . containSubset ( {
1911
+ operationType : 'insert' ,
1912
+ fullDocument : { a : 2 }
1913
+ } ) ;
1902
1914
} ) ;
1903
1915
} ) ;
1904
1916
} ) ;
0 commit comments