test: Remove react-unit-test-utils

This commit is contained in:
Diana Villalvazo
2025-06-17 10:52:56 -06:00
committed by Adolfo R. Brandes
parent 648be5f579
commit 48eeff44fe
115 changed files with 2494 additions and 9851 deletions

View File

@@ -1,4 +1,4 @@
import { shallow } from '@edx/react-unit-test-utils';
import { render, screen } from '@testing-library/react';
import { ProgramsList } from './ProgramsList';
@@ -9,15 +9,23 @@ describe('ProgramsList', () => {
title: 'Example Program 1',
},
{
programUrl: 'http://example.com',
programUrl: 'http://example2.com',
title: 'Example Program 2',
},
];
it('renders correctly', () => {
const wrapper = shallow(<ProgramsList programs={programs} />);
expect(wrapper.snapshot).toMatchSnapshot();
render(<ProgramsList programs={programs} />);
const list = screen.getByRole('list');
expect(list).toBeInTheDocument();
expect(list.children.length).toEqual(programs.length);
});
expect(wrapper.instance.findByType('li').length).toEqual(programs.length);
it('add the links correctly', () => {
render(<ProgramsList programs={programs} />);
programs.forEach(program => {
const link = screen.getByRole('link', { name: program.title });
expect(link).toHaveAttribute('href', program.url);
});
});
});