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
22
spec/PostgresStorageAdapter.spec.js
Normal file
22
spec/PostgresStorageAdapter.spec.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const PostgresStorageAdapter = require('../src/Adapters/Storage/Postgres/PostgresStorageAdapter');
|
||||
const databaseURI = 'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
|
||||
|
||||
describe_only_db('postgres')('PostgresStorageAdapter', () => {
|
||||
beforeEach(done => {
|
||||
const adapter = new PostgresStorageAdapter({ uri: databaseURI })
|
||||
.deleteAllClasses()
|
||||
.then(() => {
|
||||
adapter.handleShutdown();
|
||||
}, fail)
|
||||
.catch(done);
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', (done) => {
|
||||
const adapter = new PostgresStorageAdapter({ uri: databaseURI });
|
||||
|
||||
expect(adapter._client.$pool.ending).toEqual(false);
|
||||
adapter.handleShutdown();
|
||||
expect(adapter._client.$pool.ending).toEqual(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user