/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import React from "react";
import { render, act, screen } from "@testing-library/react";
import { useTableMetadata } from "../table-hooks";
describe("useTableMetadata", () => {
interface Props {
data?: object[];
}
const FooComponent = (props: Props) => {
const { largestTickByColumn } = useTableMetadata(props.data);
return (
<>
{Object.keys(largestTickByColumn).length}
>
);
};
test("should fetch the topic area", async () => {
const sampleData: object[] = [{ with: 50, height: 25 }];
await act(async () => {
render();
});
expect(screen.getByText(Object.keys(sampleData[0]).length)).toBeInTheDocument();
});
});