Skip to content

Commit

Permalink
chore(deps): Update @redhat-cloud-services packages (#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian authored Jan 17, 2025
1 parent e1ffacc commit 19eeb77
Show file tree
Hide file tree
Showing 7 changed files with 8,174 additions and 23,060 deletions.
5 changes: 1 addition & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ module.exports = {
],
'@babel/react',
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import',
],
plugins: ['@babel/plugin-transform-runtime'],
};
30 changes: 30 additions & 0 deletions config/mockChrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const mockChrome = {
updateDocumentTitle: () => ({}),
auth: {
getUser: () =>
Promise.resolve({
identity: {
account_number: '0',
type: 'User',
user: {
is_org_admin: true,
},
},
entitlements: {
hybrid_cloud: { is_entitled: true },
insights: { is_entitled: true },
openshift: { is_entitled: true },
smart_management: { is_entitled: false },
},
}),
},
appAction: () => ({}),
appObjectId: () => ({}),
on: () => ({}),
getUserPermissions: () => Promise.resolve(['inventory:*:*']),
isBeta: () => false,
getApp: () => 'compliance',
getBundle: () => 'insights',
};

export default mockChrome;
38 changes: 7 additions & 31 deletions config/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
import React from 'react';
import mockChrome from './mockChrome';

global.React = React;
global.fetch = jest.fn();

global.insights = {
chrome: mockChrome,
};

jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
__esModule: true,
default: () => ({
updateDocumentTitle: jest.fn(),
auth: {
getUser: () =>
Promise.resolve({
identity: {
account_number: '0',
type: 'User',
user: {
is_org_admin: true,
},
},
entitlements: {
hybrid_cloud: { is_entitled: true },
insights: { is_entitled: true },
openshift: { is_entitled: true },
smart_management: { is_entitled: false },
},
}),
},
appAction: jest.fn(),
appObjectId: jest.fn(),
on: jest.fn(),
getUserPermissions: () => Promise.resolve(['inventory:*:*']),
isBeta: jest.fn(),
getApp: () => 'compliance',
getBundle: () => 'insights',
}),
useChrome: () => ({
isBeta: jest.fn(),
}),
default: () => mockChrome,
useChrome: () => mockChrome,
}));

jest.mock(
Expand Down
11 changes: 4 additions & 7 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { defineConfig } = require('cypress');
const { devServer } = require('@cypress/webpack-dev-server');
const webpackConfig = require('./config/cypress.webpack.config.js');
const codeCoverageTask = require('@cypress/code-coverage/task');

Expand All @@ -8,12 +7,10 @@ module.exports = defineConfig({
viewportHeight: 660,
video: false,
component: {
devServer(devServerConfig) {
return devServer({
...devServerConfig,
framework: 'react',
webpackConfig,
});
devServer: {
framework: 'react',
bundler: 'webpack',
webpackConfig,
},
specPattern: 'src/**/*.cy.{js,ts,jsx,tsx}',
setupNodeEvents(on, config) {
Expand Down
5 changes: 5 additions & 0 deletions cypress/support/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ import './commands';
import '@cypress/code-coverage/support';
import '@patternfly/patternfly/patternfly.scss';
import { mount } from 'cypress/react18';
import mockChrome from '../../config/mockChrome';

Cypress.Commands.add('mount', mount);
Cypress.on(
'uncaught:exception',
(err) => !err.message.includes('ResizeObserver loop limit exceeded')
);
// Example use:
// cy.mount(<MyComponent />)
global.window.insights = {
chrome: mockChrome,
};
Loading

0 comments on commit 19eeb77

Please sign in to comment.