Skip to content

Commit

Permalink
Merge pull request #1494 from skaut/prettier-normalization
Browse files Browse the repository at this point in the history
Removed custom prettier configuration from frontend
  • Loading branch information
marekdedic authored Jun 18, 2024
2 parents e03c305 + fae3611 commit 667edfa
Show file tree
Hide file tree
Showing 59 changed files with 573 additions and 592 deletions.
19 changes: 0 additions & 19 deletions packages/frontend/.prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions packages/frontend/__mocks__/fileMock.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const filename = "test-file-stub"
export default filename
const filename = "test-file-stub";
export default filename;
70 changes: 35 additions & 35 deletions packages/frontend/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { mocked } from "jest-mock"
import { MemoryRouter } from "react-router-dom"
import renderer from "react-test-renderer"
import * as swr from "swr"
import { mocked } from "jest-mock";
import { MemoryRouter } from "react-router-dom";
import renderer from "react-test-renderer";
import * as swr from "swr";

import { App } from "../src/App"
import { testData } from "./testData"
import { App } from "../src/App";
import { testData } from "./testData";

jest.mock("swr")
jest.mock("swr");

describe("App", () => {
beforeAll(() => {
window.scrollTo = jest.fn()
})
window.scrollTo = jest.fn();
});

test("should render correctly", () => {
mocked(swr).default.mockReturnValue({
Expand All @@ -20,16 +20,16 @@ describe("App", () => {
mutate: jest.fn(),
isValidating: false,
isLoading: false,
})
});
const tree = renderer
.create(
<MemoryRouter>
<App />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render projects correctly", () => {
mocked(swr).default.mockReturnValue({
Expand All @@ -38,16 +38,16 @@ describe("App", () => {
mutate: jest.fn(),
isValidating: false,
isLoading: false,
})
});
const tree = renderer
.create(
<MemoryRouter initialEntries={["/projekty"]}>
<App />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render project listing correctly", () => {
mocked(swr).default.mockReturnValue({
Expand All @@ -56,16 +56,16 @@ describe("App", () => {
mutate: jest.fn(),
isValidating: false,
isLoading: false,
})
});
const tree = renderer
.create(
<MemoryRouter initialEntries={["/skaut/skaut-google-drive-gallery"]}>
<App />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render issue listing correctly", () => {
mocked(swr).default.mockReturnValue({
Expand All @@ -74,16 +74,16 @@ describe("App", () => {
mutate: jest.fn(),
isValidating: false,
isLoading: false,
})
});
const tree = renderer
.create(
<MemoryRouter initialEntries={["/skaut/skaut-google-drive-gallery/3"]}>
<App />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should handle error gracefully", () => {
mocked(swr).default.mockReturnValue({
Expand All @@ -92,14 +92,14 @@ describe("App", () => {
mutate: jest.fn(),
isValidating: false,
isLoading: false,
})
});
const tree = renderer
.create(
<MemoryRouter>
<App />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
})
.toJSON();
expect(tree).toMatchSnapshot();
});
});
36 changes: 18 additions & 18 deletions packages/frontend/__tests__/components/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
import renderer from "react-test-renderer"
import renderer from "react-test-renderer";

import { Button } from "../../src/components/Button"
import { Button } from "../../src/components/Button";

describe("Button component", () => {
test("should render correctly", () => {
const tree = renderer
.create(<Button href="http://www.somewhere.com">Link somewhere</Button>)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with title", () => {
const tree = renderer
.create(
<Button href="http://www.somewhere.com" title="myTitle">
Link somewhere
</Button>
</Button>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with custom class", () => {
const tree = renderer
.create(
<Button className="myClassName" href="http://www.somewhere.com">
Link somewhere
</Button>
</Button>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with target self", () => {
const tree = renderer
.create(
<Button href="http://www.somewhere.com" targetSelf>
Link somewhere
</Button>
</Button>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
})
.toJSON();
expect(tree).toMatchSnapshot();
});
});
12 changes: 6 additions & 6 deletions packages/frontend/__tests__/components/ColoredTag.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import renderer from "react-test-renderer"
import renderer from "react-test-renderer";

import { ColoredTag } from "../../src/components/ColoredTag"
import { ColoredTag } from "../../src/components/ColoredTag";

describe("ColoredTag component", () => {
test("should render correctly", () => {
const tree = renderer.create(<ColoredTag>Tag</ColoredTag>).toJSON()
expect(tree).toMatchSnapshot()
})
})
const tree = renderer.create(<ColoredTag>Tag</ColoredTag>).toJSON();
expect(tree).toMatchSnapshot();
});
});
36 changes: 18 additions & 18 deletions packages/frontend/__tests__/components/ExtLink.test.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
import renderer from "react-test-renderer"
import renderer from "react-test-renderer";

import { ExtLink } from "../../src/components/ExtLink"
import { ExtLink } from "../../src/components/ExtLink";

describe("ExtLink component", () => {
test("should render correctly", () => {
const tree = renderer
.create(<ExtLink href="http://www.somewhere.com">Link somewhere</ExtLink>)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with title", () => {
const tree = renderer
.create(
<ExtLink href="http://www.somewhere.com" title="myTitle">
Link somewhere
</ExtLink>
</ExtLink>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with custom class", () => {
const tree = renderer
.create(
<ExtLink className="myClassName" href="http://www.somewhere.com">
Link somewhere
</ExtLink>
</ExtLink>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly with target self", () => {
const tree = renderer
.create(
<ExtLink href="http://www.somewhere.com" targetSelf>
Link somewhere
</ExtLink>
</ExtLink>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
})
.toJSON();
expect(tree).toMatchSnapshot();
});
});
38 changes: 19 additions & 19 deletions packages/frontend/__tests__/components/Issue.test.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { MemoryRouter } from "react-router-dom"
import renderer from "react-test-renderer"
import { MemoryRouter } from "react-router-dom";
import renderer from "react-test-renderer";

import { Issue } from "../../src/components/Issue"
import { getIssueWithProject } from "../../src/utils/getIssueWithProject"
import { testData } from "../testData"
import { Issue } from "../../src/components/Issue";
import { getIssueWithProject } from "../../src/utils/getIssueWithProject";
import { testData } from "../testData";

const project = testData.projects[0]
const issue = project.issues[0]
const project = testData.projects[0];
const issue = project.issues[0];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Checked in the test
const issueWithProject = getIssueWithProject(
testData,
project.owner,
project.repo,
issue.number
)!
issue.number,
)!;

describe("Issue component", () => {
test("should render correctly", () => {
expect(issue).not.toBeNull()
expect(issue).not.toBeNull();
const tree = renderer
.create(
<MemoryRouter>
<Issue issue={issueWithProject} />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
.toJSON();
expect(tree).toMatchSnapshot();
});

test("should render correctly without tags", () => {
const tree = renderer
.create(
<MemoryRouter>
<Issue hideTags issue={issueWithProject} />
</MemoryRouter>
</MemoryRouter>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
})
.toJSON();
expect(tree).toMatchSnapshot();
});
});
Loading

0 comments on commit 667edfa

Please sign in to comment.