* [TNL-7269] WIP low priority tests * [TNL-7269] Add low priority tests * [TNL-7269] Fix failing EnrollmentAlert tests * [TNL-7269] Address review comments * Fixing test errors on rebase with master. Co-authored-by: Agrendalath <piotr@surowiec.it>
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import React from 'react';
|
|
import { initializeMockApp, render, screen } from '../setupTest';
|
|
import { CourseTabsNavigation } from './index';
|
|
|
|
describe('Course Tabs Navigation', () => {
|
|
beforeAll(async () => {
|
|
initializeMockApp();
|
|
});
|
|
|
|
it('renders without tabs', () => {
|
|
render(<CourseTabsNavigation tabs={[]} />);
|
|
expect(screen.getByRole('button', { name: 'More...' })).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders with tabs', () => {
|
|
const tabs = [
|
|
{ url: 'http://test-url1', title: 'Item 1', slug: 'test1' },
|
|
{ url: 'http://test-url2', title: 'Item 2', slug: 'test2' },
|
|
];
|
|
const mockData = {
|
|
tabs,
|
|
activeTabSlug: tabs[0].slug,
|
|
};
|
|
render(<CourseTabsNavigation {...mockData} />);
|
|
|
|
expect(screen.getByRole('link', { name: tabs[0].title }))
|
|
.toHaveAttribute('href', tabs[0].url)
|
|
.toHaveClass('active');
|
|
|
|
expect(screen.getByRole('link', { name: tabs[1].title }))
|
|
.toHaveAttribute('href', tabs[1].url)
|
|
.not.toHaveClass('active');
|
|
});
|
|
});
|