chore(fe): replace deprecate aliased Jest matchers with corresponding substituents (#30355)

Signed-off-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
Đỗ Trọng Hải
2024-10-30 01:27:20 +07:00
committed by GitHub
parent f2a9f31135
commit 576ad85eb4
48 changed files with 294 additions and 293 deletions

View File

@@ -108,9 +108,12 @@ test('Should have add button', async () => {
expect(
await screen.findByRole('button', { name: 'plus-large' }),
).toBeInTheDocument();
expect(props.onChange).toBeCalledTimes(0);
expect(props.onChange).toHaveBeenCalledTimes(0);
userEvent.click(screen.getByRole('button', { name: 'plus-large' }));
expect(props.onChange).toBeCalledWith([{ key: 'hrYAZ5iBH' }, undefined]);
expect(props.onChange).toHaveBeenCalledWith([
{ key: 'hrYAZ5iBH' },
undefined,
]);
});
test('Should have remove button', async () => {
@@ -120,9 +123,9 @@ test('Should have remove button', async () => {
expect(
await screen.findByRole('button', { name: 'remove-item' }),
).toBeInTheDocument();
expect(props.onChange).toBeCalledTimes(0);
expect(props.onChange).toHaveBeenCalledTimes(0);
userEvent.click(screen.getByRole('button', { name: 'remove-item' }));
expect(props.onChange).toBeCalledWith([]);
expect(props.onChange).toHaveBeenCalledWith([]);
});
test('Should have SortableDragger icon', async () => {
@@ -136,7 +139,7 @@ test('Should call Control component', async () => {
render(<CollectionControl {...props} />);
expect(await screen.findByTestId('TestControl')).toBeInTheDocument();
expect(props.onChange).toBeCalledTimes(0);
expect(props.onChange).toHaveBeenCalledTimes(0);
userEvent.click(screen.getByTestId('TestControl'));
expect(props.onChange).toBeCalledWith([{ key: 'hrYAZ5iBH' }]);
expect(props.onChange).toHaveBeenCalledWith([{ key: 'hrYAZ5iBH' }]);
});