mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 12:02:48 +00:00
updated test
This commit is contained in:
@@ -62,11 +62,11 @@ describe('Tests for admin api', ()=>{
|
||||
it('should delete a notification based on its dismiss key', async () => {
|
||||
const dismissKey = 'testKey';
|
||||
|
||||
// Mock the deleteOne function to simulate a successful deletion
|
||||
jest.spyOn(NotificationModel, 'deleteOne')
|
||||
.mockImplementationOnce((query) => {
|
||||
expect(query).toEqual({ dismissKey }); // Ensure the correct query is passed
|
||||
return Promise.resolve({ deletedCount: 1 });
|
||||
// Mock findOneAndDelete to simulate a successful deletion
|
||||
jest.spyOn(NotificationModel, 'deleteNotification')
|
||||
.mockImplementationOnce(async (key) => {
|
||||
expect(key).toBe(dismissKey); // Ensure the correct key is passed
|
||||
return { dismissKey }; // Simulate the notification object that was deleted
|
||||
});
|
||||
|
||||
const response = await app
|
||||
@@ -77,5 +77,6 @@ describe('Tests for admin api', ()=>{
|
||||
expect(response.body).toEqual({ message: 'Notification deleted successfully' });
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user