mswPathPattern โ
Returns a full URL string for MSW: baseUrl + path, with {segment} turned into MSW :segment. No query string. If your real path has extra bits not in configuration.path, adjust the string yourself.
Prefer mswEndpointHandler when you want method + URL + resolver in one helper.
Example
ts
import { http } from "msw";
import { mswPathPattern, mswEndpointResponse } from "mobx-tanstack-query-api/testing";
http.get(mswPathPattern(getUserEndpoint), ({ params }) =>
mswEndpointResponse(getUserEndpoint, {
id: params.id,
name: "Ada",
}),
);