|
1 | 1 | 'use strict';
|
2 | 2 | const { withClient, setupDatabase } = require('./shared');
|
3 |
| -const test = require('./shared').assert, |
4 |
| - expect = require('chai').expect; |
| 3 | +const test = require('./shared').assert; |
| 4 | +const { expect } = require('chai'); |
5 | 5 |
|
6 | 6 | describe('Connection', function () {
|
7 | 7 | before(function () {
|
|
280 | 280 | withClient(function (client, done) {
|
281 | 281 | expect(client.isConnected()).to.be.true;
|
282 | 282 |
|
283 |
| - const collection = client.db('testReconnect').collection('test'); |
284 |
| - collection.insertOne({ a: 1 }, (err, result) => { |
| 283 | + const collection = client.db('shouldConnectAfterClose').collection('test'); |
| 284 | + collection.insertOne({ a: 1, b: 2 }, (err, result) => { |
285 | 285 | expect(err).to.not.exist;
|
286 | 286 | expect(result).to.exist;
|
287 | 287 |
|
|
293 | 293 | expect(err).to.not.exist;
|
294 | 294 | expect(client.isConnected()).to.be.true;
|
295 | 295 |
|
296 |
| - collection.insertOne({ b: 2 }, (err, result) => { |
| 296 | + collection.findOne({ a: 1 }, (err, result) => { |
297 | 297 | expect(err).to.not.exist;
|
298 | 298 | expect(result).to.exist;
|
| 299 | + expect(result).to.have.property('a', 1); |
| 300 | + expect(result).to.have.property('b', 2); |
299 | 301 | expect(client.topology.isDestroyed()).to.be.false;
|
300 | 302 | done();
|
301 | 303 | });
|
|
0 commit comments