test(web): add unit tests for pure helper functions (#2454)
* test(web): add unit tests for pure helper functions Add vitest configuration and tests for: - relativeTime: time formatting (just now, minutes, hours, days, months, years) - lastPageFromLink: GitHub Link header pagination parsing These are the first tests for the web frontend. The test framework (vitest) was already in package.json but had no config or test files. * test(web): exercise real GitHub helpers --------- Co-authored-by: Hu Qiantao <huqiantao@HudeMacBook-Air.local> Co-authored-by: Hunter B <hmbown@gmail.com>
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ async function contributorCount(res: Response): Promise<number> {
|
||||
return MIN_KNOWN_CONTRIBUTORS;
|
||||
}
|
||||
|
||||
function lastPageFromLink(link: string | null): number | undefined {
|
||||
export function lastPageFromLink(link: string | null): number | undefined {
|
||||
if (!link) return undefined;
|
||||
|
||||
for (const part of link.split(",")) {
|
||||
|
||||
Reference in New Issue
Block a user