Patch handleShutdown feature (#4361)
* Add handleShutdown Test of MongoStorageAdapter. * Add `handleShutdown` function in PostgresStorageAdapter, with it's test. * Replace the _pgp to _client * Use `adapter._client.$pool.ending` to ckeck is ending * Add `handleShutdown()` in ParseServer.spec.js * Trigger * Set Server to Default
This commit is contained in:
committed by
Florent Vilmart
parent
de73f3723c
commit
8bf6abfee3
@@ -237,4 +237,23 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', (done) => {
|
||||
const adapter = new MongoStorageAdapter({ uri: databaseURI });
|
||||
|
||||
const schema = {
|
||||
fields: {
|
||||
array: { type: 'Array' },
|
||||
object: { type: 'Object' },
|
||||
date: { type: 'Date' },
|
||||
}
|
||||
};
|
||||
|
||||
adapter.createObject('MyClass', schema, {}).then(() => {
|
||||
expect(adapter.database.serverConfig.isConnected()).toEqual(true);
|
||||
adapter.handleShutdown()
|
||||
expect(adapter.database.serverConfig.isConnected()).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user