test: fix slugger length check in FetcherMock

This commit is contained in:
WebStreamr 2025-09-29 19:46:06 +00:00
parent 4bb8e132f5
commit 0879531478
No known key found for this signature in database

View file

@ -37,11 +37,13 @@ export class FetcherMock extends Fetcher {
};
private readonly slugifyUrl = (url: URL): string => {
if (url.href.length > 240) {
const slugifiedUrl = slugify(url.href);
if (slugifiedUrl.length > 249) {
return slugify(`${url.origin}-${crypto.createHash('md5').update(url.href).digest('hex')}`);
}
return slugify(url.href);
return slugifiedUrl;
};
private readonly fetch = async (path: string, ctx: Context, url: URL, init?: RequestInit): Promise<string> => {