This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
-
-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
Marcelo
committed
Sep 1, 2019
1 parent
53b5792
commit b4ae11b
Showing
14 changed files
with
151 additions
and
53 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
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
27 changes: 27 additions & 0 deletions
27
src/client/modules/home/ui/components/Components/__tests__/index.client.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,27 @@ | ||
import * as React from "react"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import { cleanup, wait } from "@testing-library/react"; | ||
import { renderWithRouter } from "../../../../../../utils/renderWithRouter"; | ||
import { Components } from ".."; | ||
import { act } from "react-dom/test-utils"; | ||
|
||
afterEach(cleanup); | ||
|
||
describe("<Components /> test case", () => { | ||
test("Renders loading feedback and no components", async () => { | ||
const { container } = renderWithRouter( | ||
<Components groupId={{ id: "1" }} />, | ||
{ | ||
route: "/" | ||
} | ||
); | ||
|
||
act(() => { | ||
expect(container.innerHTML).toMatch("loading..."); | ||
}); | ||
|
||
await wait(() => { | ||
expect(container.innerHTML).toMatch("You have no components yet"); | ||
}); | ||
}); | ||
}); |
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
23 changes: 23 additions & 0 deletions
23
src/client/modules/home/ui/components/ComponentsDashboard/__tests__/index.client.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 * as React from "react"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import { cleanup, wait } from "@testing-library/react"; | ||
import { renderWithRouter } from "../../../../../../utils/renderWithRouter"; | ||
import { ComponentsDashboard } from ".."; | ||
|
||
afterEach(cleanup); | ||
|
||
describe("<ComponentsDashboard /> test case", () => { | ||
test("Full component rendering/navigation", async () => { | ||
const { getByTestId } = renderWithRouter( | ||
<ComponentsDashboard groupId={{ id: "1" }} />, | ||
{ | ||
route: "/" | ||
} | ||
); | ||
|
||
await wait(() => { | ||
expect(getByTestId("components-dashboard-wrapper")).toBeInTheDocument(); | ||
expect(getByTestId("components-dashboard")).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
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
20 changes: 20 additions & 0 deletions
20
src/client/modules/home/ui/components/ErrorMessage/__tests__/index.client.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,20 @@ | ||
import * as React from "react"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import { cleanup } from "@testing-library/react"; | ||
import { renderWithRouter } from "../../../../../../utils/renderWithRouter"; | ||
import { ErrorMessage } from ".."; | ||
|
||
afterEach(cleanup); | ||
|
||
describe("<ErrorMessage /> test case", () => { | ||
test("Full component rendering/navigation", () => { | ||
const errorMessage = "Oooops, this is an error message"; | ||
const { getByTestId, getByText } = renderWithRouter( | ||
<ErrorMessage errorMessage={errorMessage} /> | ||
); | ||
|
||
expect(getByTestId("error-message-wrapper")).toBeInTheDocument(); | ||
expect(getByTestId("error-message")).toBeInTheDocument(); | ||
expect(getByText(errorMessage)).toBeInTheDocument(); | ||
}); | ||
}); |
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
19 changes: 12 additions & 7 deletions
19
src/client/modules/home/ui/components/__tests__/index.client.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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import * as React from "react"; | ||
import Home from "../.."; | ||
import { Home } from "../../"; | ||
import { renderWithRouter } from "../../../../../utils/renderWithRouter"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import { cleanup, wait } from "@testing-library/react"; | ||
|
||
afterEach(cleanup); | ||
|
||
describe("<Home /> test case", () => { | ||
test("Full component rendering/navigation", () => { | ||
const { container, getByTestId } = renderWithRouter( | ||
<Home groupId={{ id: "1" }} /> | ||
); | ||
test("Full component rendering/navigation", async () => { | ||
const { getByTestId } = renderWithRouter(<Home groupId={{ id: "1" }} />, { | ||
route: "/" | ||
}); | ||
|
||
expect(getByTestId("home-wrapper")).toBeInTheDocument(); | ||
expect(getByTestId("home")).toBeInTheDocument(); | ||
await wait(() => { | ||
expect(getByTestId("home-wrapper")).toBeInTheDocument(); | ||
expect(getByTestId("home")).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
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
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