-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 60d72b6.
- Loading branch information
1 parent
60d72b6
commit 24c41d7
Showing
6 changed files
with
119 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/hooks/api/notification/__tests__/useNotificationList.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { renderHook } from '@testing-library/react'; | ||
import useNotificationList from '../useNotificationList'; | ||
|
||
const mockNotificationListData = { | ||
data: { | ||
notifications_list: { | ||
messages: [ | ||
{ | ||
category: 'see', | ||
id: 1, | ||
message_key: 'p2p-limit-upgrade-available', | ||
}, | ||
{ | ||
category: 'see', | ||
id: 2, | ||
message_key: 'poi-verified', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
jest.mock('@deriv-com/api-hooks', () => ({ | ||
useSubscribe: jest.fn(() => mockNotificationListData), | ||
})); | ||
|
||
describe('useNotificationList', () => { | ||
it('should return the list of p2p-related notifications', () => { | ||
const { result } = renderHook(() => useNotificationList()); | ||
|
||
expect(result.current.data).toEqual([ | ||
{ | ||
category: 'see', | ||
id: 1, | ||
message_key: 'p2p-limit-upgrade-available', | ||
}, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters