Skip to content

Commit e488c1a

Browse files
committed
Fix naming of method and add missing closeDatabase function
1 parent b3be52a commit e488c1a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/integration/PetService.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { createConnection, useContainer, Connection } from 'typeorm';
33

44
import { Pet } from '../../src/api/models/Pet';
55
import { PetService } from './../../src/api/services/PetService';
6-
import { createDatabaseConnection, prepareDatabase, closeDatabase } from './utils/database';
6+
import { createDatabaseConnection, synchronizeDatabase, closeDatabase } from './utils/database';
77

88
describe('PetService', () => {
99

1010
let connection: Connection;
1111
beforeAll(async () => connection = await createDatabaseConnection());
12-
beforeEach(() => prepareDatabase(connection));
12+
beforeEach(() => synchronizeDatabase(connection));
1313
afterAll(() => closeDatabase(connection));
1414

1515
test('should create a new pet in the database', async (done) => {

test/integration/utils/database.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export const createDatabaseConnection = async (): Promise<Connection> => {
1313
return connection;
1414
};
1515

16-
export const prepareDatabase = (connection: Connection) => {
16+
export const synchronizeDatabase = (connection: Connection) => {
1717
return connection.synchronize(true);
1818
};
19+
20+
export const closeDatabase = (connection: Connection) => {
21+
return connection.close();
22+
};

0 commit comments

Comments
 (0)