/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import dayjs from "dayjs"; import { render, screen } from "@testing-library/react"; import DashboardHeader from "../DashboardHeader"; test("renders a dashboard header for a published view", async () => { const wrapper = render( , ); expect(wrapper.container).toMatchSnapshot(); }); test("renders a dashboard header for an unpublished view", async () => { const wrapper = render( , ); expect(wrapper.container).toMatchSnapshot(); }); test("renders a dashboard header for an unpublished view with a link", async () => { const wrapper = render( , ); expect(wrapper.container).toMatchSnapshot(); }); test("renders a dashboard header with lastUpdatedDate", async () => { const lastUpdated = new Date("2020-01-01T00:00:00Z"); render( , ); expect( screen.getByText( `Bananas | Last updated ${dayjs.utc(lastUpdated).format("YYYY-MM-DD HH:mm")}`, ), ).toBeInTheDocument(); });