test: add coverage for existing manager behaviour
Signed-off-by: Minn Soe <contributions@minn.io>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { createDatabaseClient } from './connection';
|
||||
import { createDatabaseClient, ensureDatabaseExists } from './connection';
|
||||
import { SingleConnectionDatabaseManager } from './SingleConnection';
|
||||
|
||||
jest.mock('./connection');
|
||||
@@ -85,5 +85,13 @@ describe('SingleConnectionDatabaseManager', () => {
|
||||
plugin2CallArgs[1].connection.database,
|
||||
);
|
||||
});
|
||||
|
||||
it('ensure plugin database is created', async () => {
|
||||
await manager.forPlugin('test').getClient();
|
||||
const mockCalls = mocked(ensureDatabaseExists).mock.calls.splice(-1);
|
||||
const [_, database] = mockCalls[0];
|
||||
|
||||
expect(database).toEqual('backstage_plugin_test');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user