Skip to content

Commit

Permalink
refactor: tests refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Feb 25, 2024
1 parent 54e580a commit 7f586f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/course-unit/add-component/AddComponent.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ describe('<AddComponent />', () => {
it('creates new "Library" xblock on click', () => {
const { getByRole } = renderComponent();

const discussionButton = getByRole('button', {
const libraryButton = getByRole('button', {
name: new RegExp(`${messages.buttonText.defaultMessage} Library Content`, 'i'),
});

userEvent.click(discussionButton);
userEvent.click(libraryButton);
expect(handleCreateNewCourseXBlockMock).toHaveBeenCalled();
expect(handleCreateNewCourseXBlockMock).toHaveBeenCalledWith({
parentLocator: '123',
Expand Down Expand Up @@ -293,11 +293,11 @@ describe('<AddComponent />', () => {

it('verifies "Text" component creation and submission in modal', () => {
const { getByRole } = renderComponent();
const advancedButton = getByRole('button', {
const textButton = getByRole('button', {
name: new RegExp(`${messages.buttonText.defaultMessage} Text`, 'i'),
});

userEvent.click(advancedButton);
userEvent.click(textButton);
const modalContainer = getByRole('dialog');

const radioInput = within(modalContainer).getByRole('radio', { name: 'Text' });
Expand All @@ -319,11 +319,11 @@ describe('<AddComponent />', () => {

it('verifies "Open Response" component creation and submission in modal', () => {
const { getByRole } = renderComponent();
const advancedButton = getByRole('button', {
const openResponseButton = getByRole('button', {
name: new RegExp(`${messages.buttonText.defaultMessage} Open Response`, 'i'),
});

userEvent.click(advancedButton);
userEvent.click(openResponseButton);
const modalContainer = getByRole('dialog');

const radioInput = within(modalContainer).getByRole('radio', { name: 'Peer Assessment Only' });
Expand Down

0 comments on commit 7f586f7

Please sign in to comment.