-
Notifications
You must be signed in to change notification settings - Fork 309
feat: fixes after package-lock regen #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5acf4e4
6910a68
c3e5cc3
b350aa4
a72e98a
aec768f
1403bc7
3443718
b8ccb3b
ed3a8d7
2faaf77
d092057
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,57 @@ jest.mock('@edx/frontend-platform/react', () => ({ ErrorPage: () => <div>ErrorPa | |
|
|
||
| jest.mock('@src/generic/PageLoading', () => jest.fn(() => <div>PageLoading</div>)); | ||
|
|
||
| jest.mock('@openedx/paragon', () => { | ||
| const actual = jest.requireActual('@openedx/paragon'); | ||
| const PropTypes = jest.requireActual('prop-types'); | ||
|
|
||
| const MockModalDialog = ({ children, isOpen, onClose }) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [important]: Is it possible to abandon the mock of this Paragon component?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this mock resolve third issue about
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this mock simulates the behavior of a modal window with |
||
| if (!isOpen) { return null; } | ||
|
|
||
| return ( | ||
| <div role="dialog" aria-modal="true" className="mock-modal"> | ||
| <button | ||
| type="button" | ||
| data-testid="modal-backdrop" | ||
| onClick={onClose} | ||
| aria-label="Close" | ||
| > | ||
| ✖ | ||
| </button> | ||
| <div className="mock-modal-content"> | ||
| {children} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| MockModalDialog.propTypes = { | ||
| children: PropTypes.node, | ||
| isOpen: PropTypes.bool, | ||
| onClose: PropTypes.func, | ||
| }; | ||
|
|
||
| const createSubComponent = (baseClass) => { | ||
| const Component = ({ children, className }) => ( | ||
| <div className={`${baseClass} ${className || ''}`}>{children}</div> | ||
| ); | ||
| Component.propTypes = { | ||
| children: PropTypes.node, | ||
| className: PropTypes.string, | ||
| }; | ||
| return Component; | ||
| }; | ||
|
|
||
| MockModalDialog.Body = createSubComponent('mock-modal-body'); | ||
| MockModalDialog.Header = createSubComponent('mock-modal-header'); | ||
| MockModalDialog.Footer = createSubComponent('mock-modal-footer'); | ||
|
|
||
| return { | ||
| ...actual, | ||
| ModalDialog: MockModalDialog, | ||
| }; | ||
| }); | ||
|
|
||
| jest.mock('./hooks', () => ({ | ||
| useIFrameBehavior: jest.fn(), | ||
| useModalIFrameData: jest.fn(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some context as to why we are removing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After regenerating
package-lock.json, the dependency updates caused thejest-console-group-reporterto fail with aTypeError: Cannot read properties of undefined (reading 'isSet')during the test run.Since this is just a reporter utility for grouping console logs and its failure was blocking the test suite execution, I removed it to restore stability to the CI pipeline.