Handle shutdown on grid adapters (#5943)
* Handle shutdown on grid adapters * Add tests * Fix postgres test
This commit is contained in:
committed by
Diamond Lewis
parent
f5ac94ddb2
commit
c951e08f63
@@ -60,4 +60,19 @@ describe('GridFSBucket and GridStore interop', () => {
|
||||
await gfsAdapter.deleteFile('myFileName');
|
||||
await expectMissingFile(gfsAdapter, 'myFileName');
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', done => {
|
||||
const databaseURI = 'mongodb://localhost:27017/parse';
|
||||
const gfsAdapter = new GridFSBucketAdapter(databaseURI);
|
||||
|
||||
gfsAdapter._connect().then(db => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(true);
|
||||
expect(db.serverConfig.s.connected).toEqual(true);
|
||||
gfsAdapter.handleShutdown().then(() => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(false);
|
||||
expect(db.serverConfig.s.connected).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user