grafana/public/app/core/components/NavLandingPage/NavLandingPageCard.test.tsx
Ashley Harrison 4abe0249ba
Chore: Clean up old navigation (#66287)
* remove code outside of the topnav feature flag

* delete NavBar folder

* remove topnav toggle from backend

* restructure AppChrome folder

* fix utils mock

* fix applinks tests

* remove tests since they're covered in e2e

* fix 1 of the approotpage tests

* Fix another dashboardpage test

* remove reverse portalling + test for plugins using deprecated onNavChanged method

* kick drone

* handle correlations
2023-04-14 09:43:11 +01:00

28 lines
985 B
TypeScript

import { render, screen } from '@testing-library/react';
import React from 'react';
import { NavLandingPageCard } from './NavLandingPageCard';
describe('NavLandingPageCard', () => {
const mockText = 'My heading';
const mockUrl = 'http://www.example.com/';
it('uses the text as a heading', () => {
render(<NavLandingPageCard text={mockText} url={mockUrl} />);
expect(screen.getByRole('heading', { name: mockText })).toBeInTheDocument();
});
it('labels the link correctly', () => {
render(<NavLandingPageCard text={mockText} url={mockUrl} />);
const link = screen.getByRole('link', { name: mockText });
expect(link).toBeInTheDocument();
expect(link).toHaveProperty('href', mockUrl);
});
it('renders the description', () => {
const mockDescription = 'My description';
render(<NavLandingPageCard text={mockText} url={mockUrl} description={mockDescription} />);
expect(screen.getByText(mockDescription)).toBeInTheDocument();
});
});