Files
kami-parse-server/spec/PostgresStorageAdapter.spec.js
Florent Vilmart 10631371e6 Introduces flow types for storage (#4349)
* Introduces flow types for storage

* Better typing of QueryOptions

* Adds flow types to SchemaCOntroller,

- runs flow on pre tests
- fixes flow

* Adds ClassLevelPermissions type

* Moves Controller types into a single file

* Changes import styles

* Changes import styles

* fixing method setIndexesWithSchemaFormat (#4454)

Fixing invalid database code in method `setIndexesWithSchemaFormat`:

* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters

* nits

* Fixes tests, improves flow typing
2017-12-30 20:44:18 -05:00

23 lines
754 B
JavaScript

import PostgresStorageAdapter from '../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();
});
});