Skip to content

Commit

Permalink
chore: fix some Sonar findings
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoerpenbeck committed Oct 16, 2024
1 parent f4ceb60 commit cc16217
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/common/httpClient/testHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class TestHttpClient implements BasicHttpClient {
const resolvedObj = resolvedHttpRequest.resolveTo;
if (resolvedObj) {
const httpResult: HttpResult<TDto> = {
body: resolvedObj as TDto,
body: resolvedObj,
statusCode: resolvedHttpRequest.resolveStatusCode ?? 200,
};
return Promise.resolve(httpResult);
Expand Down
4 changes: 1 addition & 3 deletions src/common/httpClient/testHttpClientHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ export class TestHttpClientHandler {
if (!a || !b) {
return false;
}
const equal = this.aEntriesPresentInB(a, b, ignoreKeys) && this.aEntriesPresentInB(b, a, ignoreKeys);
// console.log(`${Object.entries(a)} : ${Object.entries(b)} => equal: ${equal}`);
return equal;
return this.aEntriesPresentInB(a, b, ignoreKeys) && this.aEntriesPresentInB(b, a, ignoreKeys);
}

private aEntriesPresentInB(a: QueryParams, b: QueryParams, ignoreKeys: string[] | undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/fft-api/common/fftApiClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class FftApiClient {
retries: method === HttpMethod.GET ? MAX_RETRIES : 0,
responseType,
});
return result.body as T;
return result.body;
} catch (error) {
handleError(error);
}
Expand Down
16 changes: 7 additions & 9 deletions src/fft-api/facility/fftFacilityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class FftFacilityService {

public async getFacilityId(tenantFacilityId: string, relaxed = false): Promise<string | undefined> {
if (FftFacilityService.facilityCache.has(tenantFacilityId)) {
return FftFacilityService.facilityCache.get(tenantFacilityId) as string;
return FftFacilityService.facilityCache.get(tenantFacilityId);
}

const strippedFacilities = await this.apiClient.get<StrippedFacilities>(this.PATH, { tenantFacilityId });
Expand All @@ -46,15 +46,13 @@ export class FftFacilityService {
`Did not find exactly 1 facility with tenantFacilityId '${tenantFacilityId}' but ${length}, returning first one with id '${facility.id}'`
);
}
} else if (relaxed) {
return undefined;
} else {
if (relaxed) {
return undefined;
} else {
console.error(`Did not find facility with tenantFacilityId '${tenantFacilityId}'`);
throw new FftApiError({
message: `Did not find facility with tenantFacilityId '${tenantFacilityId}'`,
});
}
console.error(`Did not find facility with tenantFacilityId '${tenantFacilityId}'`);
throw new FftApiError({
message: `Did not find facility with tenantFacilityId '${tenantFacilityId}'`,
});
}

return facility.id;
Expand Down

0 comments on commit cc16217

Please sign in to comment.