/* eslint-disable react/prop-types */
import React from "react";
import { renderHook, cleanup } from "@testing-library/react-hooks";
import { ConfigurationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ConfigutaionContext";
import { useConfiguration } from "@applicaster/zapp-react-native-utils/reactHooks/configuration";

describe("Hooks", () => {
  afterEach(cleanup);

  describe("useConfiguration", () => {
    it("return configuration from context", () => {
      const configuration = "foobar";

      const wrapper = ({ children }) => (
        <ConfigurationContext.Provider value={configuration}>
          {children}
        </ConfigurationContext.Provider>
      );

      const {
        result: { current },
      } = renderHook(() => useConfiguration(), {
        wrapper,
      });

      expect(current).toEqual(configuration);
    });
  });
});
