-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from vordgi/get-56
get-56 improve groups parsing in get-params
- Loading branch information
Showing
4 changed files
with
41 additions
and
8 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
14 changes: 14 additions & 0 deletions
14
tests/nextjs-app/app/(frontend)/(corporate)/groups/groups.spec.ts
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,14 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test("should return correct page params and pathname", async ({ page }) => { | ||
await page.goto("/groups"); | ||
page.waitForSelector("#groups-page"); | ||
|
||
const pathname = await page.$("#get-pathname"); | ||
const pathnameRow = await pathname?.textContent(); | ||
expect(pathnameRow).toEqual("/groups"); | ||
|
||
const params = await page.$("#get-params"); | ||
const paramsRow = await params?.textContent(); | ||
expect(paramsRow && JSON.parse(paramsRow)).toEqual({}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/nextjs-app/app/(frontend)/(corporate)/groups/page.tsx
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,23 @@ | ||
import { getPathname } from "@nimpl/getters/get-pathname"; | ||
import { getParams } from "@nimpl/getters/get-params"; | ||
import { NamespaceServerContext } from "../../../../components/NamespaceServerContext"; | ||
import BlockWithContext from "../../../../components/BlockWithContext"; | ||
import Nav from "../../../../components/Nav"; | ||
|
||
export default function Page() { | ||
const pathname = getPathname(); | ||
const params = getParams(); | ||
|
||
return ( | ||
<div id="groups-page"> | ||
<Nav /> | ||
<div> | ||
<p id="get-pathname">{pathname}</p> | ||
<p id="get-params">{JSON.stringify(params)}</p> | ||
<NamespaceServerContext.Provider value={{ namespace: "dynamic-auto" }}> | ||
<BlockWithContext /> | ||
</NamespaceServerContext.Provider> | ||
</div> | ||
</div> | ||
); | ||
} |