Skip to content

Commit 3eea24c

Browse files
Merge pull request #10 from flarelabs-net/test/post
test POST routes
2 parents b42a1fd + 591801f commit 3eea24c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/api/e2e-tests/base.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ test("the application's noop index page is visible and it allows navigating to t
99
await expect(page.getByText("Hello World!")).toBeVisible();
1010
});
1111

12-
test("the hello-world api route works as intended", async ({ page }) => {
12+
test("the hello-world api GET route works as intended", async ({ page }) => {
1313
const res = await page.request.get("/api/hello");
1414
expect(res.headers()["content-type"]).toContain("text/plain");
1515
expect(await res.text()).toEqual("Hello World!");
1616
});
17+
18+
test("the hello-world api POST route works as intended", async ({ page }) => {
19+
const res = await page.request.post("/api/hello", { data: "some body" });
20+
expect(res.headers()["content-type"]).toContain("text/plain");
21+
await expect(res.text()).resolves.toEqual("Hello post-World! body=some body");
22+
});

0 commit comments

Comments
 (0)