Skip to content

Commit 66ae226

Browse files
committed
test(NODE-4763): incorporated suggested changes in assertions
1 parent 9ed6270 commit 66ae226

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

test/integration/change-streams/change_stream.test.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,27 +1862,35 @@ describe('Change Streams', function () {
18621862

18631863
await collection.insertOne({ a: 1 });
18641864
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+
});
18671869

18681870
await collection.insertOne({ a: 2 });
18691871
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+
});
18721876
});
18731877

18741878
it('#tryNext', { requires: { topology: 'replicaset' } }, async function test() {
18751879
await initIteratorMode(changeStream);
18761880

18771881
await collection.insertOne({ a: 1 });
18781882
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+
});
18811887

18821888
await collection.insertOne({ a: 2 });
18831889
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+
});
18861894
});
18871895
});
18881896

@@ -1892,13 +1900,17 @@ describe('Change Streams', function () {
18921900

18931901
await collection.insertOne({ a: 1 });
18941902
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+
});
18971907

18981908
await collection.insertOne({ a: 2 });
18991909
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+
});
19021914
});
19031915
});
19041916
});

0 commit comments

Comments
 (0)