-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.test.js
48 lines (44 loc) · 1.29 KB
/
Main.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* eslint-disable no-unused-vars */
import { Provider } from "react-redux";
import { RouterProvider } from "react-router";
import { render, screen } from "@testing-library/react";
import renderer from "react-test-renderer";
import store from "./redux/store";
import { router } from "./App";
import Header from "./components/Header";
import Footer from "./components/Footer";
import ContactPage from "./pages/ContactPage";
import { getCountriesData } from "./redux/countriesSlice";
describe("Header component", () => {
test("should have 'Space Travelers Hub' text", () => {
render(
<Provider store={store}>
<RouterProvider router={router}>
<Header />
</RouterProvider>
</Provider>
);
const ele = screen.getByText("Home");
expect(ele).toBeInTheDocument();
});
});
describe("Contact component", () => {
it("renders correctly", () => {
const tree = renderer
.create(
<Provider store={store}>
<RouterProvider router={router}>
<ContactPage />
</RouterProvider>
</Provider>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
describe("Countries reducer", () => {
it("should return an array ", async () => {
const arr = getCountriesData;
expect(arr.length).toBe(1);
});
});