forked from Ivasoft/mattermost-mobile
* Refactored storage layer - in progress * Refactored DatabaseManager & Operators * Renamed isRecordAppEqualToRaw to isRecordInfoEqualToRaw * Review feedback * Update app/database/models/app/info.ts Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com> * Update app/database/models/server/my_team.ts Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com> Co-authored-by: Avinash Lingaloo <> Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
24 lines
738 B
TypeScript
24 lines
738 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import DatabaseManager from '@database/manager';
|
|
import {DatabaseType} from '@typings/database/enums';
|
|
|
|
export const createTestConnection = async ({databaseName = 'db_name', setActive = false}) => {
|
|
const serverUrl = 'https://appv2.mattermost.com';
|
|
await DatabaseManager.init([]);
|
|
const server = await DatabaseManager.createServerDatabase({
|
|
config: {
|
|
dbName: databaseName,
|
|
dbType: DatabaseType.SERVER,
|
|
serverUrl,
|
|
},
|
|
});
|
|
|
|
if (setActive && server) {
|
|
await DatabaseManager.setActiveServerDatabase(serverUrl);
|
|
}
|
|
|
|
return server?.database;
|
|
};
|