Skip to content

Commit

Permalink
test(utils): refactor nested template literals
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabb-c committed Jan 13, 2025
1 parent 38bb78a commit 8a65740
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/utils/base-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ export const baseHandler = <
mockResponse: R,
identifier = "",
): HttpHandler => {
// Constructs the full URL for the mock request, including any identifier.
const url = `${BASE_URL.REST}${endpoint}${identifier ? `/${identifier}` : ""}`;
let url = `${BASE_URL.REST}${endpoint}`;

if (identifier) {
url = `${url}/${identifier}`;
}

// Defines a mocked GET request handler that returns the provided mockResponse.
return http.get<P, B, R>(url, async () => {
return HttpResponse.json(mockResponse);
});
Expand Down

0 comments on commit 8a65740

Please sign in to comment.