Skip to content

Commit

Permalink
fix: regression in delay notification state after tailwind animations
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed Jun 14, 2024
1 parent 13c57df commit 9dd817b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hooks/useNotifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { act, renderHook, waitFor } from '@testing-library/react';
import axios, { AxiosError } from 'axios';
import nock from 'nock';

import { mockSingleAccountNotifications } from '../__mocks__/notifications-mocks';
import {
mockAuth,
mockGitHubCloudAccount,
Expand Down Expand Up @@ -299,6 +300,10 @@ describe('hooks/useNotifications.ts', () => {

describe('removeNotificationFromState', () => {
it('should remove a notification from state', async () => {
const mockElement = document.createElement('div');
mockElement.id = mockSingleAccountNotifications[0].notifications[0].id;
jest.spyOn(document, 'getElementById').mockReturnValue(mockElement);

const notifications = [
{ id: 1, title: 'This is a notification.' },
{ id: 2, title: 'This is another one.' },
Expand Down
4 changes: 4 additions & 0 deletions src/utils/remove-notification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { removeNotification } from './remove-notification';

describe('utils/remove-notification.ts', () => {
it('should remove a notification if it exists', () => {
const mockElement = document.createElement('div');
mockElement.id = mockSingleAccountNotifications[0].notifications[0].id;
jest.spyOn(document, 'getElementById').mockReturnValue(mockElement);

expect(mockSingleAccountNotifications[0].notifications.length).toBe(1);

const result = removeNotification(
Expand Down

0 comments on commit 9dd817b

Please sign in to comment.