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:
CHANG, TZU-YEN
2017-11-19 04:20:19 +08:00
committed by Florent Vilmart
parent de73f3723c
commit 8bf6abfee3
4 changed files with 79 additions and 0 deletions

View File

@@ -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();
});
});
});