Skip to content

Commit

Permalink
Suppressed Css error
Browse files Browse the repository at this point in the history
  • Loading branch information
im-vedant committed Dec 16, 2024
1 parent 9c87ad3 commit 99caf14
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/MemberDetail/customTableCell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('CustomTableCell', () => {
await waitFor(() => screen.getByTestId('custom-row'));

expect(screen.getByText('Test Event')).toBeInTheDocument();
expect(screen.getByText('May 1, 2023')).toBeInTheDocument();
expect(screen.getByText('1 May 2023')).toBeInTheDocument();
expect(screen.getByText('Yes')).toBeInTheDocument();
expect(screen.getByText('2')).toBeInTheDocument();

Expand Down
10 changes: 6 additions & 4 deletions src/components/OrganizationScreen/OrganizationScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ describe('Testing OrganizationScreen', () => {
fireEvent.click(closeButton);

// Check for contract class after closing
expect(screen.getByTestId('mainpageright')).toHaveClass('_expand_ccl5z_8');
expect(
screen.getByTestId('mainpageright').className.includes('expand'),
).toBeTruthy();

const openButton = screen.getByTestId('openMenu');
fireEvent.click(openButton);

// Check for expand class after opening
expect(screen.getByTestId('mainpageright')).toHaveClass(
'_contract_ccl5z_61',
);
expect(
screen.getByTestId('mainpageright').className.includes('contract'),
).toBeTruthy();
});

test('handles window resize', () => {
Expand Down
13 changes: 11 additions & 2 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ global.fetch = jest.fn();

import { format } from 'util';

global.console.error = function (...args): void {
throw new Error(format(...args));
const jsDomCssError = 'Error: Could not parse CSS stylesheet';

// Override console.error to suppress the CSS parsing error
global.console.error = (...params) => {
// If the error message is related to CSS parsing, suppress it
if (params.find((p) => p.toString().includes(jsDomCssError))) {
return; // Do nothing for this error
}

// Otherwise, throw an error or log the message
throw new Error(format(...params)); // You can choose to throw or log here
};

global.console.warn = function (...args): void {
Expand Down

0 comments on commit 99caf14

Please sign in to comment.