import React, { useState } from "react";
import Text from "../../components/atoms/text/text";
import { fireEvent, render } from "@testing-library/react-native";
import { ThemeProvider } from "../../theme/src/theme-context";
import Box from "../../components/atoms/box/box";
import { Pressable } from "react-native";
import { useColorScheme } from "../useColorScheme";
jest.useFakeTimers();
const TestComponent = props => {
  const [useScheme, setUseScheme] = useState(false);
  const updatedObj = useColorScheme(props.colorScheme, props.object);
  return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, useScheme ? updatedObj.color : props.object.color), /*#__PURE__*/React.createElement(Pressable, {
    onPress: () => setUseScheme(true),
    testID: "switchButton"
  }, "Use color scheme"));
};
describe("useColorScheme", () => {
  it("leaves values unchanged for missing color scheme", () => {
    const {
      getByText,
      getByTestId
    } = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(TestComponent, {
      colorScheme: null,
      object: {
        color: "primary100",
        fontSize: 20
      }
    })));
    expect(getByText("primary100")).toBeTruthy();
    const toggleButton = getByTestId("switchButton");
    fireEvent.press(toggleButton);
    expect(getByText("primary100")).toBeTruthy();
  });
  it("switches values containing primary to secondary", () => {
    const {
      getByText,
      getByTestId
    } = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(TestComponent, {
      colorScheme: "secondary",
      object: {
        color: "primary100",
        fontSize: 20
      }
    })));
    expect(getByText("primary100")).toBeTruthy();
    const toggleButton = getByTestId("switchButton");
    fireEvent.press(toggleButton);
    expect(getByText("secondary100")).toBeTruthy();
  });
});
//# sourceMappingURL=useColorScheme.spec.js.map