Skip to content

Commit f021f1a

Browse files
committed
upd for e2e
1 parent caa6d32 commit f021f1a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/e2e/helpers/api/api-database.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function getDatabaseByConnectionType(connectionType?: string): Prom
136136
let response: object = {};
137137
response = await asyncFilter(allDataBases, async(item: databaseParameters) => {
138138
await doAsyncStuff();
139-
return await item.connectionType === connectionType;
139+
return item.connectionType === connectionType;
140140
});
141141
return await response[0].id;
142142
}
@@ -167,10 +167,14 @@ export async function deleteAllDatabasesApi(): Promise<void> {
167167
*/
168168
export async function deleteStandaloneDatabaseApi(databaseParameters: AddNewDatabaseParameters): Promise<void> {
169169
const databaseId = await getDatabaseIdByName(databaseParameters.databaseName);
170+
if (databaseId) {
170171
await request(endpoint).delete('/databases')
171172
.send({ 'ids': [`${databaseId}`] })
172173
.set('Accept', 'application/json')
173174
.expect(200);
175+
} else {
176+
throw new Error('Error: Missing databaseId');
177+
}
174178
}
175179

176180
/**
@@ -185,6 +189,8 @@ export async function deleteStandaloneDatabasesByNamesApi(databaseNames: string[
185189
.send({ 'ids': [`${databaseId}`] })
186190
.set('Accept', 'application/json')
187191
.expect(200);
192+
} else {
193+
throw new Error('Error: Missing databaseId');
188194
}
189195
});
190196
}
@@ -229,8 +235,8 @@ export async function deleteAllDatabasesByConnectionTypeApi(connectionType: stri
229235
* @param databasesParameters The databases parameters as array
230236
*/
231237
export async function deleteStandaloneDatabasesApi(databasesParameters: AddNewDatabaseParameters[]): Promise<void> {
232-
if (await databasesParameters.length) {
233-
await databasesParameters.forEach(async parameter => {
238+
if (databasesParameters.length) {
239+
databasesParameters.forEach(async parameter => {
234240
await deleteStandaloneDatabaseApi(parameter);
235241
});
236242
}

0 commit comments

Comments
 (0)