* 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
23 lines
759 B
JavaScript
23 lines
759 B
JavaScript
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();
|
|
});
|
|
});
|