Skip to content

Commit

Permalink
test(table): prevent console.warn logging expected warning to test ou…
Browse files Browse the repository at this point in the history
…tput
  • Loading branch information
adrianschmidt committed May 7, 2024
1 parent a0cb7db commit 81ccd04
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/table/columns.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,18 @@ describe('createCustomComponent', () => {
name: 'not-existing-component',
};

// Mock console.warn to avoid the warning message in the test output
const consoleWarnSpy = jest
.spyOn(console, 'warn')
.mockImplementation(() => {});

const definition = factory.create(column);
expect(definition.formatter).toBe(formatCell);

// Fail if there are unexpected warnings
expect(consoleWarnSpy).toHaveBeenCalledTimes(1);

jest.restoreAllMocks();
});

it('uses the default formatter if the custom component misses a name prop', () => {
Expand Down

0 comments on commit 81ccd04

Please sign in to comment.