Skip to content

Commit 3ca47f2

Browse files
committed
chore(EMS-4099): improve api test helper logs
1 parent fd67901 commit 3ca47f2

29 files changed

+243
-207
lines changed

src/api/test-helpers/account-status.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const deleteAll = async (context: Context) => {
2323

2424
return [];
2525
} catch (error) {
26-
console.error(error);
26+
console.error('Error getting and deleting an account status (test helpers)');
2727

28-
throw new Error(`Getting and deleting account status (test helpers) ${error}`);
28+
throw new Error(`Getting and deleting an account status (test helpers) ${error}`);
2929
}
3030
};
3131

@@ -68,7 +68,7 @@ const create = async ({ context, data, accountId, deleteAccountStatus = true }:
6868

6969
return accountStatus;
7070
} catch (error) {
71-
console.error('Error creating account status %o', error);
71+
console.error('Error creating account status (test helpers) %o', error);
7272

7373
return error;
7474
}
@@ -92,7 +92,7 @@ const get = async (context: Context, accountStatusId: string) => {
9292

9393
return accountStatus;
9494
} catch (error) {
95-
console.error(error);
95+
console.error('Error getting an account status by ID (test helpers)');
9696

9797
throw new Error(`Getting an account status by ID (test helpers) ${error}`);
9898
}
@@ -117,7 +117,7 @@ const update = async (context: Context, accountStatusId: string, data: AccountSt
117117

118118
return accountStatus;
119119
} catch (error) {
120-
console.error(error);
120+
console.error('Error updating an account status by ID (test helpers)');
121121

122122
throw new Error(`Updating an account status by ID (test helpers) ${error}`);
123123
}

src/api/test-helpers/accounts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const deleteAll = async (context: Context) => {
2828

2929
return [];
3030
} catch (error) {
31-
console.error(error);
31+
console.error('Error getting and deleting accounts (test helpers)');
3232

3333
throw new Error(`Getting and deleting accounts (test helpers) ${error}`);
3434
}
@@ -53,7 +53,7 @@ const get = async (context: Context, accountId: string): Promise<Account> => {
5353

5454
return account;
5555
} catch (error) {
56-
console.error(error);
56+
console.error('Error getting an account by ID (test helpers)');
5757

5858
throw new Error(`Getting an account by ID (test helpers) ${error}`);
5959
}
@@ -94,7 +94,7 @@ const create = async ({ context, data, deleteAccounts = true }: TestHelperAccoun
9494

9595
return updatedAccount;
9696
} catch (error) {
97-
console.error(error);
97+
console.error('Error creating an account (test helpers)');
9898

9999
return error;
100100
}
@@ -119,7 +119,7 @@ const update = async (context: Context, accountId: string, data: AccountCreation
119119

120120
return account;
121121
} catch (error) {
122-
console.error(error);
122+
console.error('Error updating an account by ID (test helpers)');
123123

124124
throw new Error(`Updating an account by ID (test helpers) ${error}`);
125125
}

src/api/test-helpers/applications.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const create = async ({ context }: TestHelperApplicationCreate) => {
2828

2929
return application;
3030
} catch (error) {
31-
console.error(error);
31+
console.error('Error creating an application (test helpers)');
3232

3333
return error;
3434
}
@@ -52,7 +52,7 @@ const get = async ({ context, applicationId }: TestHelperApplicationGet): Promis
5252

5353
return application;
5454
} catch (error) {
55-
console.error(error);
55+
console.error('Error getting an application (test helpers)');
5656

5757
return error;
5858
}
@@ -72,7 +72,7 @@ const getAll = async (context: Context): Promise<Application> => {
7272

7373
return applications;
7474
} catch (error) {
75-
console.error(error);
75+
console.error('Error getting all applications (test helpers)');
7676

7777
return error;
7878
}
@@ -96,7 +96,7 @@ const update = async ({ context, applicationId, data }: TestHelperApplicationUpd
9696

9797
return application;
9898
} catch (error) {
99-
console.error(error);
99+
console.error('Error updating an application (test helpers)');
100100

101101
return error;
102102
}
@@ -124,7 +124,7 @@ const deleteAll = async (context: Context) => {
124124

125125
return [];
126126
} catch (error) {
127-
console.error(error);
127+
console.error('Error getting and deleting applications (test helpers)');
128128

129129
throw new Error(`Getting and deleting applications (test helpers) ${error}`);
130130
}

src/api/test-helpers/auth-retries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const findAll = async (context: Context) => {
1414

1515
return retries;
1616
} catch (error) {
17-
console.error(error);
17+
console.error('Error getting auth retries (test helpers)');
1818

1919
throw new Error(`Getting auth retries (test helpers) ${error}`);
2020
}
@@ -38,7 +38,7 @@ const deleteAll = async (context: Context) => {
3838

3939
return deleted;
4040
} catch (error) {
41-
console.error(error);
41+
console.error('Error deleting auth retries (test helpers)');
4242

4343
return error;
4444
}

src/api/test-helpers/broker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const create = async (context: Context) => {
1515

1616
return broker;
1717
} catch (error) {
18-
console.error(error);
18+
console.error('Error creating a broker (test helpers)');
1919

2020
return error;
2121
}
@@ -38,7 +38,7 @@ const get = async (context: Context, brokerId: string) => {
3838

3939
return broker;
4040
} catch (error) {
41-
console.error(error);
41+
console.error('Error getting a broker by ID (test helpers)');
4242

4343
throw new Error(`Getting an broker by ID (test helpers) ${error}`);
4444
}

src/api/test-helpers/business.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const create = async (context: Context) => {
1515

1616
return business;
1717
} catch (error) {
18-
console.error(error);
18+
console.error('Error creating a business (test helpers)');
1919

2020
return error;
2121
}
@@ -38,7 +38,7 @@ const get = async (context: Context, businessId: string) => {
3838

3939
return business;
4040
} catch (error) {
41-
console.error(error);
41+
console.error('Error getting a business by ID (test helpers)');
4242

4343
throw new Error(`Getting an business by ID (test helpers) ${error}`);
4444
}

src/api/test-helpers/buyer-relationship.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const create = async (context: Context, data = {}) => {
1717

1818
return buyerRelationship;
1919
} catch (error) {
20-
console.error(error);
20+
console.error('Error creating a buyer relationship (test helpers)');
2121

2222
return error;
2323
}

src/api/test-helpers/buyer-trading-history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const create = async (context: Context, data = {}) => {
1717

1818
return buyer;
1919
} catch (error) {
20-
console.error(error);
20+
console.error('Error creating a buyerTradingHistory (test helpers)');
2121

2222
return error;
2323
}

src/api/test-helpers/buyer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const create = async (context: Context, data = {}) => {
1717

1818
return buyer;
1919
} catch (error) {
20-
console.error(error);
20+
console.error('Error creating a buyer (test helpers)');
2121

2222
return error;
2323
}
@@ -37,7 +37,7 @@ const getAll = async (context: Context) => {
3737

3838
return buyers;
3939
} catch (error) {
40-
console.error(error);
40+
console.error('Error getting all buyers (test helpers)');
4141

4242
throw new Error(`Getting all buyers (test helpers) ${error}`);
4343
}
@@ -65,7 +65,7 @@ const deleteAll = async (context: Context) => {
6565

6666
return [];
6767
} catch (error) {
68-
console.error(error);
68+
console.error('Error getting and deleting all buyers (test helpers)');
6969

7070
throw new Error(`Getting and deleting all buyers (test helpers) ${error}`);
7171
}

src/api/test-helpers/company.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const createCompany = async (context: Context, data = {}) => {
1818

1919
return company;
2020
} catch (error) {
21-
console.error(error);
21+
console.error('Error creating a company (test helpers)');
2222

2323
return error;
2424
}
@@ -42,7 +42,7 @@ const deleteCompany = async (context: Context, companyId: string) => {
4242

4343
return response;
4444
} catch (error) {
45-
console.error(error);
45+
console.error('Error deleting a company (test helpers)');
4646

4747
throw new Error(`Deleting company (test helpers) ${error}`);
4848
}
@@ -56,7 +56,7 @@ const deleteCompany = async (context: Context, companyId: string) => {
5656
*/
5757
const deleteCompanyAddress = async (context: Context, companyAddressId: string) => {
5858
try {
59-
console.info('Deleting company address (test helpers)');
59+
console.info('Deleting companyAddress (test helpers)');
6060

6161
const response = await context.query.CompanyAddress.deleteMany({
6262
where: {
@@ -66,7 +66,7 @@ const deleteCompanyAddress = async (context: Context, companyAddressId: string)
6666

6767
return response;
6868
} catch (error) {
69-
console.error(error);
69+
console.error('Error deleting company address (test helpers)');
7070

7171
throw new Error(`Deleting company address (test helpers) ${error}`);
7272
}
@@ -88,7 +88,7 @@ const deleteCompanySicCode = async (context: Context, companySicId: string) => {
8888

8989
return response;
9090
} catch (error) {
91-
console.error(error);
91+
console.error('Error deleting company SIC code (test helpers)');
9292

9393
throw new Error(`Deleting company SIC code (test helpers) ${error}`);
9494
}
@@ -112,7 +112,7 @@ const createCompanyAddress = async (context: Context, data = {}) => {
112112

113113
return company;
114114
} catch (error) {
115-
console.error(error);
115+
console.error('Error creating a company address (test helpers)');
116116

117117
return error;
118118
}
@@ -141,7 +141,7 @@ const createCompanySicCode = async (context: Context, companyId: string) => {
141141

142142
return companySicCode;
143143
} catch (error) {
144-
console.error(error);
144+
console.error('Error creating a company SIC code (test helpers)');
145145

146146
return error;
147147
}
@@ -171,7 +171,7 @@ const createCompanyDifferentTradingAddress = async (context: Context, companyId:
171171

172172
return differentTradingAddress;
173173
} catch (error) {
174-
console.error(error);
174+
console.error('Error creating a company different trading address (test helpers)');
175175

176176
throw new Error(`Creating a company different trading address (test helpers) ${error}`);
177177
}
@@ -195,7 +195,7 @@ const getCompany = async (context: Context, companyId: string) => {
195195

196196
return company;
197197
} catch (error) {
198-
console.error(error);
198+
console.error('Error getting a company by ID (test helpers)');
199199

200200
throw new Error(`Getting a company by ID (test helpers) ${error}`);
201201
}
@@ -219,7 +219,7 @@ const getCompanyAddress = async (context: Context, companyAddressId: string) =>
219219

220220
return companyAddress;
221221
} catch (error) {
222-
console.error(error);
222+
console.error('Error getting a company address by ID (test helpers)');
223223

224224
throw new Error(`Getting a company address by ID (test helpers) ${error}`);
225225
}
@@ -247,7 +247,7 @@ const getCompanySicCodes = async (context: Context, companyId: string) => {
247247

248248
return companySic;
249249
} catch (error) {
250-
console.error(error);
250+
console.error('Error getting a company SIC code by company ID (test helpers)');
251251

252252
throw new Error(`Getting company SIC code by company ID (test helpers) ${error}`);
253253
}

src/api/test-helpers/country.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const create = async (context: Context) => {
2020

2121
return country;
2222
} catch (error) {
23-
console.error(error);
23+
console.error('Error creating a country (test helpers)');
2424

2525
return error;
2626
}

src/api/test-helpers/cover-period.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const create = async (context: Context) => {
2323

2424
return coverPeriod;
2525
} catch (error) {
26-
console.error(error);
26+
console.error('Error creating a coverPeriod (test helpers)');
2727

2828
return error;
2929
}

0 commit comments

Comments
 (0)