@material-ui/icons#Router JavaScript Examples

The following examples show how to use @material-ui/icons#Router. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddEditZoneFullMount.test.js    From medha-STPC with GNU Affero General Public License v3.0 5 votes vote down vote up
describe("testing for zone", () => {
  const setIndex = jest.fn();
  const setLoaderStatus = jest.fn();

  beforeEach(() => {
    useStateMock.mockImplementation(init => [init, setIndex]);
    useStateMock.mockImplementation(init => [init, setLoaderStatus]);
  });

  it("test for  autocomplete field", () => {
    auth.setToken(medhaAdminUser.jwt, true);
    auth.setUserInfo(medhaAdminUser.user, true);
    const addEditZoneSpy = jest
      .spyOn(serviceProviders, "serviceProviderForGetRequest")
      .mockImplementation(() => {
        return new Promise(resolve => {
          return resolve({
            data: {
              result: [
                {
                  id: 1,
                  name: "Uttar Pradesh",
                  is_active: true,
                  abbreviation: "UP",
                  identifier: "",
                  country: {
                    id: 1,
                    name: "India",
                    is_active: true,
                    abbreviation: "IN",
                    identifier: "IN",
                    created_at: "2020-06-24T07:09:28.236Z",
                    updated_at: "2020-06-24T07:09:28.236Z"
                  },
                  created_at: "2020-06-24T07:09:28.252Z",
                  updated_at: "2020-06-24T07:09:28.252Z"
                }
              ],
              page: 1,
              pageSize: 10,
              rowCount: 1,
              pageCount: 1
            }
          });
        });
      });

    //jest.spyOn(React, "useState").mockImplementation(setYearDataUseState);
    let wrapper = mount(
      <LoaderContext.Provider value={{ setLoaderStatus }}>
        <SetIndexContext.Provider value={{ setIndex }}>
          <Router>
            <AddEditZone />
          </Router>
        </SetIndexContext.Provider>
      </LoaderContext.Provider>
    );

    // /** This actually checks whether the post method is called with proper url and request body */
    // expect(addEditZoneSpy.mock.calls).toEqual([
    //   [
    //     "https://medha-devlopment.wastaging.com/crm-plugin/states",
    //     {
    //       name_contains: "Uttar Pradesh"
    //     }
    //   ]
    // ]);

    // /** This actually checks whether the post method is called */
    // expect(addEditZoneSpy).toHaveBeenCalledTimes(1);
    wrapper.unmount();
  });
});