Showing a error "Trim not defined jest testing issue". In jest testing library.
import * as React from 'react';
import { ChipListComponent, ChipsDirective, ChipDirective } from '@syncfusion/ej2-react-buttons';
export default class Tags extends React.Component {
render() {
return (
<span data-testid={this.props.testid}>
<ChipListComponent id="chip-avatar" enableDelete={true}>
<ChipsDirective>
<ChipDirective text={this.props.text}></ChipDirective>
</ChipsDirective>
</ChipListComponent>
</span>
);
}
}
----------------------------------------------------------------------------------------
import React from 'react';
import { render, screen } from '@testing-library/react';
import Text from './Text';
window.crypto = jest.fn();
window.crypto.getRandomValues = jest.fn();
window.getComputedStyle = (eletm, select) => getComputedStyle(eletm, select);
const { getComputedStyle } = global.window;
render(<Text text="Security" testid="TextTest" iconclass="e-icons e-lock"></Text>);
const TextTest = screen.getByTestId('TextTest');
describe('test 5 - check the rendering', () => {
it('renders without crashing', () => {
expect(TextTest).toBeInTheDocument;
});
});