-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move 'getNextPageToken' to services layer
- Loading branch information
Showing
4 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getNextPageToken } from "@/services/kratos" | ||
|
||
describe("decoding link header", () => { | ||
const withNext = | ||
'</admin/clients?page_size=5&page_token=euKoY1BqY3J8GVax>; rel="first",</admin/clients?page_size=5&page_token=h9LfEKUiFoLH2R0A>; rel="next"' | ||
|
||
const withoutNext = | ||
'</admin/clients?page_size=5&page_token=euKoY1BqY3J8GVax>; rel="first"' | ||
|
||
it("try decoding link successfully", () => { | ||
expect(getNextPageToken(withNext)).toBe("h9LfEKUiFoLH2R0A") | ||
}) | ||
|
||
it("should be undefined when no more next is present", () => { | ||
expect(getNextPageToken(withoutNext)).toBe(undefined) | ||
}) | ||
}) |