Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit ed461f6

Browse files
committed
chore(eslint): add playwright specific rules
- fix linting errors
1 parent 9233b97 commit ed461f6

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ module.exports = {
104104
],
105105
"import/prefer-default-export": "off",
106106
"no-console": ["warn", { allow: ["warn", "error"] }],
107+
"playwright/prefer-to-be": "error",
108+
"playwright/prefer-to-have-length": "error",
109+
"playwright/require-top-level-describe": "error",
107110
"prettier/prettier": "error",
108111
"react/jsx-sort-props": [
109112
"error",

src/components/Avatar/Avatar.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ import { Avatar } from "./Avatar";
1010

1111
const { mail } = MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME;
1212

13-
test.beforeEach(async ({ page }) => {
14-
await page.route(`**/v1.0/users/${mail}/photos/64x64/$value`, async (route) => {
15-
return route.fulfill({
16-
body: Buffer.from(MOCK_RESPONST_MICROSOFT_GRAPH_GET_USERS_PHOTOS_64_VALUE, "base64"),
17-
contentType: "image/jpeg",
18-
status: 200,
13+
test.describe("Avatar", () => {
14+
test.beforeEach(async ({ page }) => {
15+
await page.route(`**/v1.0/users/${mail}/photos/64x64/$value`, async (route) => {
16+
return route.fulfill({
17+
body: Buffer.from(MOCK_RESPONST_MICROSOFT_GRAPH_GET_USERS_PHOTOS_64_VALUE, "base64"),
18+
contentType: "image/jpeg",
19+
status: 200,
20+
});
1921
});
2022
});
21-
});
2223

23-
test.describe("Avatar", () => {
2424
test("renders photo with valid id", async ({ mount }) => {
2525
const component = await mount(
2626
<BrowserRouter>

src/components/Greeter/Greeter.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME } from "../../utils/test/api.me.mo
55
import { MsalMock } from "../../utils/test/MsalMock";
66
import { Greeter } from "./Greeter";
77

8-
test.beforeEach(async ({ page }) => {
9-
await page.route("**/v1.0/me/", (route) => {
10-
return route.fulfill({
11-
body: JSON.stringify(MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME),
12-
contentType: "application/json",
13-
status: 200,
8+
test.describe("Greeter", () => {
9+
test.beforeEach(async ({ page }) => {
10+
await page.route("**/v1.0/me/", (route) => {
11+
return route.fulfill({
12+
body: JSON.stringify(MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME),
13+
contentType: "application/json",
14+
status: 200,
15+
});
1416
});
1517
});
16-
});
1718

18-
test.describe("Greeter", () => {
1919
test("renders", async ({ mount }) => {
2020
const component = await mount(
2121
<BrowserRouter>

src/pages/ProtectedPages.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME } from "../utils/test/api.me.mock"
55
import { MsalMock } from "../utils/test/MsalMock";
66
import { ProtectedPages } from "./ProtectedPages";
77

8-
test.beforeEach(async ({ page }) => {
9-
await page.route("**/v1.0/me/", (route) => {
10-
return route.fulfill({
11-
body: JSON.stringify(MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME),
12-
contentType: "application/json",
13-
status: 200,
8+
test.describe("ProtectedPages", () => {
9+
test.beforeEach(async ({ page }) => {
10+
await page.route("**/v1.0/me/", (route) => {
11+
return route.fulfill({
12+
body: JSON.stringify(MOCK_RESPONSE_MICROSOFT_GRAPH_GET_ME),
13+
contentType: "application/json",
14+
status: 200,
15+
});
1416
});
1517
});
16-
});
1718

18-
test.describe("ProtectedPages", () => {
1919
test("renders", async ({ mount }) => {
2020
const component = await mount(
2121
<BrowserRouter>

0 commit comments

Comments
 (0)