{"size": 1119, "ext": "js", "max_stars_repo_path": "client/src/components/ItemsView/__test__/index.test.js", "max_stars_repo_name": "Pioryd/site", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/components/ItemsView/__test__/index.test.js", "max_issues_repo_name": "Pioryd/site", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/src/components/ItemsView/__test__/index.test.js", "max_forks_repo_name": "Pioryd/site", "max_forks_repo_forks_event_min_datetime": "2021-04-12T06:26:39.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-12T06:26:39.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 24.8666666667, "max_line_length": 73, "alphanum_fraction": 0.6237712243}
import "regenerator-runtime/runtime";
import React from "react";
import { render, waitFor } from "@testing-library/react";
import { Provider } from "react-redux";
import { BrowserRouter } from "react-router-dom";

import store from "../../../redux/store";
import * as ITEMS from "../../../redux/modules/items/const";

import ItemsView from "../index.js";

function renderWithReduxAndRouter(props) {
  return render(
    <Provider store={store}>
      <BrowserRouter>
        <ItemsView {...props} />
      </BrowserRouter>
    </Provider>
  );
}

describe("Component - Items View", () => {
  beforeAll(() => {
    console.error = () => {};
  });

  test("loading", async () => {
    const rendered = renderWithReduxAndRouter({ searchType: "general" });

    expect(rendered.queryByText("loading...")).toBeTruthy();

    await store.dispatch({
      type: ITEMS.UPDATE_PAGINATION,
      payload: { totalItems: 20, currentPage: 1, totalPages: 2 }
    });

    await waitFor(() => {});
    expect(rendered.queryByText("loading...")).not.toBeTruthy();
  });
});

test("update", async () => {
  expect(true).toBe(true);
});
