-
Notifications
You must be signed in to change notification settings - Fork 310
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 3 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 |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ describe('NotificationsWidget', () => { | |
| } | ||
|
|
||
| beforeEach(async () => { | ||
| global.innerWidth = breakpoints.large.minWidth; | ||
| global.innerWidth = breakpoints.large.minWidth ?? 992; | ||
|
||
| store = initializeStore(); | ||
| axiosMock = new MockAdapter(getAuthenticatedHttpClient()); | ||
| axiosMock.onGet(courseMetadataUrl).reply(200, defaultMetadata); | ||
|
|
||
| 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(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,19 @@ describe('Courseware Service', () => { | |
| mergeConfig({ | ||
| LMS_BASE_URL: 'http://localhost:8081', | ||
| }, 'Custom app config for pact tests'); | ||
|
|
||
| // Mock Intl.DateTimeFormat to return a consistent timezone across all environments | ||
| // This ensures that the browser_timezone query parameter matches the pact file | ||
| const OriginalDateTimeFormat = Intl.DateTimeFormat; | ||
| jest.spyOn(Intl, 'DateTimeFormat').mockImplementation((...args) => { | ||
|
||
| const dtf = new OriginalDateTimeFormat(...args); | ||
| const originalResolvedOptions = dtf.resolvedOptions.bind(dtf); | ||
| dtf.resolvedOptions = () => ({ | ||
| ...originalResolvedOptions(), | ||
| timeZone: 'Asia/Karachi', | ||
| }); | ||
| return dtf; | ||
| }); | ||
| }); | ||
|
|
||
| describe('When a request to get a learning sequence outline is made', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| const path = require('path'); | ||
| const { createConfig } = require('@openedx/frontend-build'); | ||
| const sass = require('sass'); | ||
|
|
||
| const config = createConfig('webpack-dev'); | ||
|
|
||
|
|
@@ -8,4 +9,43 @@ config.resolve.alias = { | |
| '@src': path.resolve(__dirname, 'src'), | ||
| }; | ||
|
|
||
| // Fix for react-focus-on webpack 5 compatibility issue | ||
| // The package has ES modules without file extensions in imports | ||
| config.module.rules.push({ | ||
| test: /\.m?js$/, | ||
| resolve: { | ||
| fullySpecified: false, | ||
| }, | ||
| }); | ||
|
|
||
| // Fix for sass-loader deprecation warnings | ||
| config.module.rules.forEach((rule) => { | ||
|
||
| if (rule.oneOf) { | ||
| rule.oneOf.forEach((oneOfRule) => { | ||
| if (oneOfRule.use) { | ||
| oneOfRule.use.forEach((loaderConfig) => { | ||
| if (loaderConfig.loader && loaderConfig.loader.includes('sass-loader')) { | ||
| // eslint-disable-next-line no-param-reassign | ||
| loaderConfig.options = { | ||
| ...loaderConfig.options, | ||
| api: 'modern', | ||
| implementation: sass, | ||
| sassOptions: { | ||
| ...loaderConfig.options?.sassOptions, | ||
| silenceDeprecations: [ | ||
| 'import', | ||
| 'abs-percent', | ||
| 'color-functions', | ||
| 'global-builtin', | ||
| 'legacy-js-api', | ||
| ], | ||
| }, | ||
| }; | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| module.exports = config; | ||
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.