/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import React from "react";
import { render, fireEvent, act } from "@testing-library/react";
import Search from "../Search";
test("renders a small search input", () => {
const wrapper = render();
expect(wrapper.container).toMatchSnapshot();
});
test("renders a big input", () => {
const wrapper = render();
expect(wrapper.container).toMatchSnapshot();
});
test("calls onSubmit when user presses search button", async () => {
const onSearch = jest.fn();
const { getByRole } = render();
await act(async () => {
fireEvent.click(getByRole("button"));
});
expect(onSearch).toBeCalled();
});