• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cartesi / rollups-explorer / 7650503353

25 Jan 2024 05:59AM UTC coverage: 95.036% (+0.06%) from 94.978%
7650503353

Pull #69

github

dandheedge
fix: failing test on sendTransaction unit test
Pull Request #69: 56. Fix the logical condition for displaying the warning.

361 of 440 branches covered (0.0%)

Branch coverage included in aggregate %.

5095 of 5301 relevant lines covered (96.11%)

14.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.86
/apps/web/src/hooks/usePaginationParams.tsx
1
import { usePathname, useRouter, useSearchParams } from "next/navigation";
1✔
2
import { pathOr } from "ramda";
1✔
3
import { useCallback } from "react";
1✔
4

1✔
5
export const limitBounds = {
1✔
6
    "10": 10,
1✔
7
    "20": 20,
1✔
8
    "30": 30,
1✔
9
} as const;
1✔
10

1✔
11
export type LimitBound = (typeof limitBounds)[keyof typeof limitBounds];
1✔
12

1✔
13
export type UsePaginationReturn = [
1✔
14
    { limit: LimitBound; page: number },
1✔
15
    (page: number, limit: LimitBound) => void,
1✔
16
];
1✔
17

1✔
18
export const usePaginationParams = (): UsePaginationReturn => {
1✔
19
    const searchParams = useSearchParams();
×
20
    const router = useRouter();
×
21
    const pathName = usePathname();
×
22
    const urlSearchParams = new URLSearchParams(searchParams);
×
23
    const pg = parseInt(urlSearchParams.get("pg") ?? "");
×
24
    const lt = urlSearchParams.get("lt") ?? limitBounds[10];
×
25
    const limit = pathOr(limitBounds[10], [lt], limitBounds);
×
26
    const page = isNaN(pg) ? 1 : pg;
×
27

×
28
    const updateParams = useCallback(
×
29
        (page: number, limit: number): void => {
×
30
            const urlSearchParams = new URLSearchParams({
×
31
                pg: page.toString(),
×
32
                lt: limit.toString(),
×
33
            });
×
34

×
35
            router.push(`${pathName}?${urlSearchParams.toString()}`, {
×
36
                scroll: false,
×
37
            });
×
38
        },
×
39
        [router, pathName],
×
40
    );
×
41

×
42
    return [{ page, limit }, updateParams];
×
43
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc