Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Nov 20, 2024
1 parent 5449977 commit adee623
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/course-unit/add-component/AddComponent.test.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
import MockAdapter from 'axios-mock-adapter';
import {
act, render, screen, waitFor, within,
Expand All @@ -8,6 +9,7 @@ import { initializeMockApp } from '@edx/frontend-platform';
import { AppProvider } from '@edx/frontend-platform/react';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { Button } from '@openedx/paragon';

import initializeStore from '../../store';
import { executeThunk } from '../../utils';
Expand All @@ -24,7 +26,7 @@ let store;
let axiosMock;
const blockId = '123';
const handleCreateNewCourseXBlockMock = jest.fn();
const usageKey = 'lb:Axim:TEST:html:571fe018-f3ce-45c9-8f53-5dafcb422fddest-usage-key'
const usageKey = 'lb:Axim:TEST:html:571fe018-f3ce-45c9-8f53-5dafcb422fddest-usage-key';

// Mock ComponentPicker to call onComponentSelected on click
jest.mock('../../library-authoring/component-picker', () => ({
Expand All @@ -41,10 +43,12 @@ jest.mock('../../library-authoring/component-picker', () => ({
blockType: 'html',
}]);
}
}
return <button onClick={onClick}>
Dummy button
</button>;
};
return (
<Button onClick={onClick}>
Dummy button
</Button>
);
},
}));

Expand All @@ -61,7 +65,8 @@ const renderComponent = (props) => render(
<IframeProvider>
<AddComponent
blockId={blockId}
handleCreateNewCourseXBlock={handleCreateNewCourseXBlockMock} {...props}
handleCreateNewCourseXBlock={handleCreateNewCourseXBlockMock}
{...props}
/>
</IframeProvider>
</IntlProvider>
Expand Down Expand Up @@ -494,14 +499,12 @@ describe('<AddComponent />', () => {
const submitBtn = await screen.findByRole('button', { name: 'Add selected components' });
userEvent.click(submitBtn);

expect(mockSendMessageToIframe).toHaveBeenCalledWith(
messageTypes.addSelectedComponentsToBank, {
selectedComponents: [{
blockType: "html",
usageKey,
}],
}
);
expect(mockSendMessageToIframe).toHaveBeenCalledWith(messageTypes.addSelectedComponentsToBank, {
selectedComponents: [{
blockType: 'html',
usageKey,
}],
});
});

describe('component support label', () => {
Expand Down

0 comments on commit adee623

Please sign in to comment.