From 7f15dceef7041c27add485453c275c85d91b3652 Mon Sep 17 00:00:00 2001
From: 0x1eef <0x1eef@protonmail.com>
Date: Fri, 29 Sep 2023 15:25:24 -0300
Subject: [PATCH] Run eslint on `test/`
---
test/App.test.tsx | 20 ++++++++++----------
test/ErrorRenderer.test.tsx | 4 ++--
test/ResponseRenderer.test.tsx | 10 +++++-----
test/mocks/fetch.ts | 10 +++++-----
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/test/App.test.tsx b/test/App.test.tsx
index 036dd16..0e9cf90 100644
--- a/test/App.test.tsx
+++ b/test/App.test.tsx
@@ -1,13 +1,13 @@
import React from "react";
-import '@testing-library/jest-dom'
-import { render, screen, act, waitFor } from "@testing-library/react";
+import '@testing-library/jest-dom';
+import { render, screen, act } from "@testing-library/react";
import { App } from "~/components/App";
import { getMessage } from "./mocks/chrome.i18n";
import { success, error, loading } from "./mocks/fetch";
describe("App.tsx", () => {
beforeEach(() => {
- const chrome: any = {i18n: {getMessage}};
+ const chrome: any = { i18n: { getMessage } };
global.chrome = chrome;
});
@@ -16,18 +16,18 @@ describe("App.tsx", () => {
});
describe("when the request is loading", () => {
- beforeEach(() => { global.fetch = loading });
- afterEach(() => { global.fetch = undefined });
+ beforeEach(() => { global.fetch = loading; });
+ afterEach(() => { global.fetch = undefined; });
test("loading text is rendered", () => {
render();
expect(screen.getByText("Loading...")).toBeInTheDocument();
- })
+ });
});
describe("when the request is a success", () => {
- beforeEach(() => { global.fetch = success });
- afterEach(() => { global.fetch = undefined });
+ beforeEach(() => { global.fetch = success; });
+ afterEach(() => { global.fetch = undefined; });
test("response is rendered", async () => {
await act(() => render());
@@ -36,8 +36,8 @@ describe("App.tsx", () => {
});
describe("when the request throws an error", () => {
- beforeEach(() => { global.fetch = error });
- afterEach(() => { global.fetch = undefined });
+ beforeEach(() => { global.fetch = error; });
+ afterEach(() => { global.fetch = undefined; });
test("error is rendered", async () => {
await act(() => render());
diff --git a/test/ErrorRenderer.test.tsx b/test/ErrorRenderer.test.tsx
index b182003..4003d9d 100644
--- a/test/ErrorRenderer.test.tsx
+++ b/test/ErrorRenderer.test.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import '@testing-library/jest-dom'
+import '@testing-library/jest-dom';
import { render, screen } from "@testing-library/react";
import { ErrorRenderer } from "~/components/ErrorRenderer";
import { getMessage } from "./mocks/chrome.i18n";
@@ -8,7 +8,7 @@ describe("ErrorRenderer.tsx", () => {
const error = new Error("This is an example error message");
beforeEach(() => {
- const chrome: any = {i18n: {getMessage}};
+ const chrome: any = { i18n: { getMessage } };
global.chrome = chrome;
render();
});
diff --git a/test/ResponseRenderer.test.tsx b/test/ResponseRenderer.test.tsx
index 8bec523..4e4eaa9 100644
--- a/test/ResponseRenderer.test.tsx
+++ b/test/ResponseRenderer.test.tsx
@@ -1,12 +1,12 @@
import React from "react";
-import '@testing-library/jest-dom'
+import '@testing-library/jest-dom';
import { render, screen } from "@testing-library/react";
import { ResponseRenderer } from "~/components/ResponseRenderer";
import { getMessage } from "./mocks/chrome.i18n";
describe("ResponseRenderer.tsx", () => {
beforeEach(() => {
- const chrome: any = {i18n: {getMessage}};
+ const chrome: any = { i18n: { getMessage } };
global.chrome = chrome;
});
@@ -23,7 +23,7 @@ describe("ResponseRenderer.tsx", () => {
};
describe("when isTorExitNode is false", () => {
- const response = {...defaultResponse};
+ const response = { ...defaultResponse };
beforeEach(() => {
render();
@@ -56,7 +56,7 @@ describe("ResponseRenderer.tsx", () => {
});
describe("when isTorExitNode is true", () => {
- const response = {...defaultResponse, isTorExitNode: true};
+ const response = { ...defaultResponse, isTorExitNode: true };
beforeEach(() => {
render();
@@ -65,6 +65,6 @@ describe("ResponseRenderer.tsx", () => {
test("isTorExitNode is rendered as Yes", () => {
expect(screen.getByText("Tor exit node")).toBeInTheDocument();
expect(screen.getByText("Yes")).toBeInTheDocument();
- })
+ });
});
});
diff --git a/test/mocks/fetch.ts b/test/mocks/fetch.ts
index 8504e1f..c739791 100644
--- a/test/mocks/fetch.ts
+++ b/test/mocks/fetch.ts
@@ -1,4 +1,4 @@
-import {TServerResponse} from "~/lib/response";
+import { TServerResponse } from "~/lib/response";
export function success(_path: RequestInfo | URL, _options?: RequestInit) {
const json = () => (
@@ -11,18 +11,18 @@ export function success(_path: RequestInfo | URL, _options?: RequestInit) {
YourFuckingTorExit: false
})
)
- ))
+ ));
return new Promise((resolve) => {
- resolve({status: 200, json});
+ resolve({ status: 200, json });
});
}
export function error(_path: RequestInfo | URL, _options?: RequestInit) {
return new Promise(() => {
throw new Error("Request error");
- })
-};
+ });
+}
export function loading(_path: RequestInfo | URL, _options?: RequestInit) {
return new Promise(() => null);