next-page-tester
Version:
Enable DOM integration testing on Next.js pages
20 lines (19 loc) • 747 B
TypeScript
import type { PageParams } from '../../commonTypes';
export declare enum ROUTE_PARAMS_TYPES {
DYNAMIC = "dynamic",
CATCH_ALL = "catch_all",
OPTIONAL_CATCH_ALL = "optional_catch_all"
}
export declare function encodeCaptureGroupName(string: string): string;
/**
* Build a regex from a page path to catch its matching routes
* @returns a regex and the map of the types of params found
*/
export declare function pagePathToRouteRegex(pagePath: string): {
regex: RegExp;
paramTypes: Record<string, ROUTE_PARAMS_TYPES>;
};
export declare function makeParamsObject({ routeRegexCaptureGroups, paramTypes, }: {
routeRegexCaptureGroups?: Record<string, string>;
paramTypes: Record<string, ROUTE_PARAMS_TYPES>;
}): PageParams;