Skip to content
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

test(mrc): use internals polyfill instead of mock #15242

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(mrc): use internals polyfill instead of mock
Signed-off-by: Tristan WAGNER <t.wagner66250@gmail.com>
  • Loading branch information
tristanwagner committed Jan 31, 2025
commit 17af00f82b8be943ffbd57c429e26f0fefc6c7ed
Original file line number Diff line number Diff line change
@@ -99,16 +99,6 @@ const DatagridTest = ({
};

describe('Paginated datagrid component', () => {
beforeAll(() => {
// Mock attachInternals method for all instances of custom elements
(HTMLElement.prototype.attachInternals as unknown) = vitest.fn(() => ({
// Mock the properties or methods used from internals
setValidity: vitest.fn(),
states: new Set(),
setFormValue: vitest.fn(),
}));
});

it('should display the correct number of columns', async () => {
const { container } = render(
<DatagridTest
5 changes: 1 addition & 4 deletions packages/manager-react-components/vitest.setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// vitest.setup.js
import '@testing-library/jest-dom';

global.HTMLElement.prototype.attachInternals = function () {
return {}; // Return an empty object or mock the internals as needed
};
import 'element-internals-polyfill';