import React from "react";
import Text from "../../components/atoms/text/text";
import { render } from "@testing-library/react-native";
import { ThemeProvider } from "../../theme/src/theme-context";
import Box from "../../components/atoms/box/box";
import { useStyleProps } from "../useStyleProps";
import { allStyleFunctions } from "../../theme/src/style-functions";
import { getKeys } from "../../theme/utils/type-helpers";
jest.useFakeTimers();
const TestComponent = props => {
  const rest = useStyleProps(props.object, allStyleFunctions);
  return /*#__PURE__*/React.createElement(Box, rest, /*#__PURE__*/React.createElement(Text, null, getKeys(rest.style).length));
};
describe("useStyleProps", () => {
  it("return empty style object for missing props", () => {
    const comp = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(TestComponent, {
      object: null
    })));
    const tree = comp.toJSON();
    expect(tree).toMatchSnapshot();
    expect(comp.getByText("0")).toBeTruthy();
  });
  it("return correct style object for props", () => {
    const comp = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(TestComponent, {
      object: {
        backgroundColor: "pink",
        p: "0.75"
      }
    })));
    const tree = comp.toJSON();
    expect(tree).toMatchSnapshot();
    expect(comp.getByText("2")).toBeTruthy();
  });
});
//# sourceMappingURL=useStyledProps.spec.js.map