import React from "react";
import { render } from "@testing-library/react-native";
import { useConfiguration } from "@applicaster/zapp-react-native-utils/reactHooks/configuration";
import { View } from "react-native";
import { withConfigurationProvider } from "@applicaster/zapp-react-native-ui-components/Decorators/ConfigurationWrapper";

describe("withConfigurationProvider", () => {
  const TestComponent = () => {
    const configuration = useConfiguration();

    // @ts-ignore
    return <View {...configuration} />;
  };

  it("correctly passes all the configuration keys child component", () => {
    const Component = withConfigurationProvider(TestComponent);

    const { toJSON } = render(
      <Component
        screenData={{ styles: {}, general: {}, data: { source: "test" } }}
      />
    );

    expect(toJSON()).toMatchSnapshot();
  });
});
