Skip to content

Commit

Permalink
Merge pull request #1800 from Adslot/renovate-react-toastify-10.x
Browse files Browse the repository at this point in the history
fix(deps): update dependency react-toastify to v10
  • Loading branch information
xiaofan2406 committed Apr 5, 2024
2 parents 217f2dd + d401302 commit 6370baf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
28 changes: 10 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"react-popper": "^2.3.0",
"react-select": "^5.8.0",
"react-slick": "^0.30.2",
"react-toastify": "^9.1.3",
"react-toastify": "^10.0.5",
"ryze": "^0.1.2",
"slick-carousel": "^1.8.1"
},
Expand Down
62 changes: 35 additions & 27 deletions src/components/Toast/index.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { toast } from 'react-toastify';
import { render, screen, waitFor } from 'testing';
import { render, screen, waitFor, act } from 'testing';
import Toast, { ToastMessage } from '.';

describe('Toast.notify', () => {
it('should render notification as expected', async () => {
const toastSpy = jest.spyOn(toast, 'info');

render(<Toast.Container />);
Toast.notify({
message: 'Testing Toast',
act(() => {
Toast.notify({ message: 'Testing Toast' });
});

expect(toastSpy).toHaveBeenCalledTimes(1);
Expand All @@ -21,9 +21,8 @@ describe('Toast.notify', () => {

it('should render default info type', async () => {
render(<Toast.Container />);
Toast.notify({
title: 'test',
message: 'Default toast',
act(() => {
Toast.notify({ title: 'test', message: 'Default toast' });
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand All @@ -36,10 +35,12 @@ describe('Toast.notify', () => {
it('should render success type', async () => {
render(<Toast.Container />);

Toast.notify({
title: 'SUCCESS',
theme: 'success',
message: 'Success toast',
act(() => {
Toast.notify({
title: 'SUCCESS',
theme: 'success',
message: 'Success toast',
});
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand All @@ -54,10 +55,12 @@ describe('Toast.notify', () => {
it('should render alert type', async () => {
render(<Toast.Container />);

Toast.notify({
title: 'ALERT',
theme: 'alert',
message: 'Alert toast',
act(() => {
Toast.notify({
title: 'ALERT',
theme: 'alert',
message: 'Alert toast',
});
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand All @@ -72,10 +75,12 @@ describe('Toast.notify', () => {
it('should render attention type', async () => {
render(<Toast.Container />);

Toast.notify({
title: 'ATTENTION',
theme: 'attention',
message: 'Attention toast',
act(() => {
Toast.notify({
title: 'ATTENTION',
theme: 'attention',
message: 'Attention toast',
});
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand All @@ -89,11 +94,12 @@ describe('Toast.notify', () => {

it('should render info type', async () => {
render(<Toast.Container />);

Toast.notify({
title: 'INFO',
theme: 'info',
message: 'Info toast',
act(() => {
Toast.notify({
title: 'INFO',
theme: 'info',
message: 'Info toast',
});
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand All @@ -120,10 +126,12 @@ describe('<ToastMessage />', () => {
describe('<Toast.Container />', () => {
it('should render Toast.Container without error', async () => {
render(<Toast.Container />);
Toast.notify({
title: 'test',
theme: 'attention',
message: 'Testing Toast',
act(() => {
Toast.notify({
title: 'test',
theme: 'attention',
message: 'Testing Toast',
});
});
await waitFor(() => {
expect(screen.getByClass('aui--toast-body-message')).toBeInTheDocument();
Expand Down

0 comments on commit 6370baf

Please sign in to comment.