Skip to content

Commit 8a65740

Browse files
committed
test(utils): refactor nested template literals
1 parent 38bb78a commit 8a65740

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/utils/base-handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ export const baseHandler = <
2525
mockResponse: R,
2626
identifier = "",
2727
): HttpHandler => {
28-
// Constructs the full URL for the mock request, including any identifier.
29-
const url = `${BASE_URL.REST}${endpoint}${identifier ? `/${identifier}` : ""}`;
28+
let url = `${BASE_URL.REST}${endpoint}`;
29+
30+
if (identifier) {
31+
url = `${url}/${identifier}`;
32+
}
3033

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

0 commit comments

Comments
 (0)